title: Unobtrusive validation not working on some elements
body: <p>I have a very odd problem with unobtrusive validation.</p>
  
  <p>I have a model with a Required attribute on three stirng properties.  I'm using TextBoxFor for two of the fields, and TextAreaFor for the last.  The validation is working on the TextArea, but NOT on the input fields.  Looking at the source, I can see that the attributes that the validation adds are not on the inputs, but ARE on the text box.  Additionally, if I enter data into the text box and submit, it posts and MVC model binding DOES correctly set ModelState.IsValid to false and the ValidationSummary shows the fields.  </p>
  
  <p>What would cause the validation to not work on the input elements?</p>
  
  <p>Model:</p>
  
  <pre><code>    public class TestModel : IEmail {
          public string BCCAddresses {
              get;
              set;
          }
  
          [Required]
          public string BodyFormat {
              get;
              set;
          }
  
          public string CCAddresses {
              get;
              set;
          }
  
          [Required]
          public string FromAddress {
              get;
              set;
          }
  
          [Required]
          public string SubjectLineFormat {
              get;
              set;
          }
    }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>@section head {
      &lt;script src="@Url.Content( "~/Scripts/jquery.1.7.1.min.js" )" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="@Url.Content( "~/Scripts/jquery.validate.min.js" )" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="@Url.Content( "~/Scripts/jquery.validate.unobtrusive.min.js" )" type="text/javascript"&gt;&lt;/script&gt;
  
  }
  
  
  @{
      Html.EnableClientValidation();
      Html.EnableUnobtrusiveJavaScript();
  }
  
              @using ( Html.BeginForm( "Edit", "Email", FormMethod.Post ) ) {
                  &lt;table&gt;
                      &lt;tr&gt;
                          &lt;td&gt;From&lt;/td&gt;
                          &lt;td&gt;@Html.TextBoxFor( x =&gt; x.FromAddress, new { style = "width: 500px;" } )&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td&gt;CC&lt;/td&gt;
                          &lt;td&gt;@Html.TextBoxFor( x =&gt; x.CCAddresses, new { style = "width: 500px;" } )&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td&gt;BCC&lt;/td&gt;
                          &lt;td&gt;@Html.TextBoxFor( x =&gt; x.BCCAddresses, new { style = "width: 500px;" } )&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;&lt;td colspan="2"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td colspan="2"&gt;Subject Line&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td colspan="2"&gt;@Html.TextBoxFor( x =&gt; x.SubjectLineFormat, new { style = "width: 500px;" } )&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;&lt;td colspan="2"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td colspan="2"&gt;Body Form&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td colspan="2"&gt;@Html.TextAreaFor( x =&gt; x.BodyFormat, new { style = "width: 500px; height: 200px" } )&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;&lt;td colspan="2"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td colspan="2"&gt;
                              &lt;input id="ApplyChanges" type="submit" class="NavigationButton"  value="Save Changes" /&gt; 
                              &lt;input id="CancelChanges" type="button" class="NavigationButton" value="Cancel Changes" /&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td colspan="2"&gt;
                              @Html.ValidationSummary()
                          &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;&lt;td colspan="2"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
                  &lt;/table&gt;
              }
  </code></pre>
  
  <p>Browser source:</p>
  
  <pre><code>&lt;form action="/url" method="post"&gt;
                  &lt;table&gt;
                      &lt;tbody&gt;&lt;tr&gt;
                          &lt;td&gt;From&lt;/td&gt;
                          &lt;td&gt;&lt;input style="width: 500px;" id="FromAddress" name="FromAddress" value="" type="text"&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td&gt;CC&lt;/td&gt;
                          &lt;td&gt;&lt;input style="width: 500px;" id="CCAddresses" name="CCAddresses" value="" type="text"&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td&gt;BCC&lt;/td&gt;
                          &lt;td&gt;&lt;input style="width: 500px;" id="BCCAddresses" name="BCCAddresses" value="" type="text"&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;&lt;td colSpan="2"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td colSpan="2"&gt;Subject Line&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td colSpan="2"&gt;&lt;input style="width: 500px;" id="SubjectLineFormat" name="SubjectLineFormat" value="" type="text"&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;&lt;td colSpan="2"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td colSpan="2"&gt;Body Form&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td colSpan="2"&gt;&lt;textarea style="width: 500px; height: 200px;" id="BodyFormat" cols="20" rows="2" name="BodyFormat" data-val-required="The BodyFormat field is required." data-val="true"&gt;&lt;/textarea&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;&lt;td colSpan="2"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td colSpan="2"&gt;
                              &lt;input id="ApplyChanges" class="NavigationButton" disabled="disabled" value="Save Changes" type="submit"&gt; 
                              &lt;input id="CancelChanges" class="NavigationButton" value="Cancel Changes" type="button"&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td colSpan="2"&gt;
                              &lt;div class="validation-summary-valid" data-valmsg-summary="true"&gt;&lt;ul&gt;&lt;li style="display: none;"&gt;&lt;/li&gt;
  &lt;/ul&gt;&lt;/div&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;&lt;td colSpan="2"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
                  &lt;/tbody&gt;&lt;/table&gt;
  &lt;/form&gt;
  </code></pre>