title: Why validation is not working with Html.TextBoxFor but is when using Html.EditorFor?
body: <p>I am trying MVC's datatype attributes, and just created a simple scenario like the following:</p>
  
  <p>The <strong>View</strong>:</p>
  
  <pre><code>@model MVC4.Models.Model
  
  @{
      ViewBag.Title = "DataTypeAttribute";
      Layout = "~/Views/Shared/_Layout.cshtml";
  }
  &lt;script src="~/Scripts/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/jquery.validate.min.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/jquery.validate.unobtrusive.min.js"&gt;&lt;/script&gt;
  
  &lt;h2&gt;DataTypeAttribute&lt;/h2&gt;
  
  
  @using (Html.BeginForm("SubmitData", "Home"))
  {
      &lt;div&gt;
          @Html.ValidationSummary()
      &lt;/div&gt;
  
      @Html.EditorFor(m =&gt; m.Email)
      &lt;br /&gt;
      &lt;br /&gt;
      @Html.EditorFor(m =&gt; m.PostalCode)
  
      &lt;br /&gt;
      &lt;br /&gt;
      @Html.EditorFor(m =&gt; m.TextOnly)
      &lt;br /&gt;
      &lt;br /&gt;
  
      &lt;button type="submit"&gt;Submit&lt;/button&gt;
  }
  </code></pre>
  
  <p>The <strong>Model</strong>:</p>
  
  <pre><code>public class Model
  {
      [DataType(DataType.EmailAddress)]
  
      [Required]
      //[EmailAddress]
      public string Email { get; set; }
  
      [DataType(DataType.PostalCode)]
      public string PostalCode { get; set; }
  
  
      public string TextOnly { get; set; }
  }
  </code></pre>
  
  <p>"SubmitData" is just a controller that, returns View(..., model) if ModelState.IsValid is false.</p>
  
  <p>Although posts like <a href="https://stackoverflow.com/questions/4826173/differences-between-html-textboxfor-and-html-editorfor-in-mvc-and-razor">this</a> do a good job in tackling the differences between Html.TextBoxFor and Html.EditorFor, I could not find an answer as to why validation for the <em>datatype EmailAddress</em> will not work when using <em>TextBoxFor</em>. I did find people mentioning TextBoxFor does not take metadata into account, while EditorFor does. </p>
  
  <p>But does this make sense ? So TextBoxFor does not offer support for client validations ?!</p>
  
  <p>I wonder what is the reason for the difference between the two ?</p>