title: ASP.NET MVC how to get no validation on form for model
body: <p>I have a registration form and a login form for users. I want validation on the Registration form obviously, but I do not want it on the login form. I've noticed it validates things with JS on the login form. I.E it doesn't even try to submit the form until the user types in a password of length over 5 (I.E what I set in the validation). How do I disable this?</p>
  
  <p>Login form:</p>
  
  <pre><code>@using (Html.BeginForm("Login", "Users", FormMethod.Post, new { @class = "well"})) {
  
          &lt;legend&gt;Login&lt;/legend&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Email)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.TextBoxFor(model =&gt; model.Email, new { @placeholder = "Email" })
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Password)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.TextBoxFor(model =&gt; model.Password, new { @placeholder = "Password" })
          &lt;/div&gt;
  
          &lt;label class="checkbox"&gt;
              @Html.CheckBoxFor(model =&gt; model.HasRememberMeOn) Remember me
          &lt;/label&gt;
  
  
          if (ViewData["ErrorMessage"] != null)
          {
                  &lt;p&gt;@ViewData["ErrorMessage"]&lt;/p&gt;
          }
          &lt;p&gt;
              &lt;input type="submit" value="Login" /&gt;
          &lt;/p&gt;
  
  }
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>[Required]
          [StringLength(20, MinimumLength=5)]
          [Username(ErrorMessage="Username must: Contain at least one letter, no spaces, no special characters")]
          public string Username { get; set; }
  
          [NotMapped]
          [StringLength(25, MinimumLength = 5)]
          public string Password { get; set; }
  
          [Required(ErrorMessage="Password is required")]
          public string HashedPassword { get; set; }
  
          [Required]
          [StringLength(50, MinimumLength = 3)]
          public string Email { get; set; }
  
          [NotMapped]
          [Compare("Email", ErrorMessage = "Your emails don't match")]
          [DisplayName("Confirm email")]
          public string Email2 { get; set; }
  
          public Boolean IsActivated { get; set; }
  
          [DisplayName("Date joined")]
          public DateTime DateCreated { get; set; }
  
          [Required]
          [StringLength(50, MinimumLength = 2)]
          [DisplayName("Real name")]
          public string Name { get; set; }
  </code></pre>