title: ASP.Net MVC 5 Html.BeginForm onsubmit and model with required attribute
body: <p>I have required attribute on my model properties but I added a "spinner" to show processing request in form onsubmit. Now, even though that it didn't submit the form, it shows the "spinner" i created, and stuck on the overlay but the textbox with required attribute is in focus.</p>
  
  <pre><code>using (Html.BeginForm("Add", "UserAccount", FormMethod.Post, new { onsubmit="spinner()"}))
  {
  //Html.TextBoxes for model properties with required
  }
  &lt;div id="spinner" hidden=""&gt;
      &lt;div&gt;
          &lt;i class="fa fa-spinner fa-spin fa-pulse" style="color: white; font-    size: 50px;"&gt;&lt;/i&gt;
          &lt;label style="color: white; font-size: 50px;"&gt;Processing&lt;/label&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  
  
  
  &lt;script&gt;
  function spinner() {
      $("#spinner").show();
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Is their a way to check first if the "required" attribute is satisfied before accessing the onsubmit function?</p>