title: Html.BeginForm using onSubmit to validate
body: <p>Am trying to submit a my form , however i have added some jquery for validation which works:</p>
  
  <pre><code>    $(function validateForm() {
      $("#newMonoReading").on('focusout', function () {
          var str = "";
  
          var initialMonoReading = $('#InitialMonoReading').val();
          var newMonoReading = $('#newMonoReading').val()
          if (~~newMonoReading &lt; ~~initialMonoReading) {
              $('#MonoErrorMessage').text("New Mono Readings must be MORE than existing");
              $('#MonoErrorMessage').show();
              return false;
  
  
          } else {
              $('#MonoErrorMessage').hide();
  
          }
      });
  });
  </code></pre>
  
  <p>But the problem is on the submit button </p>
  
  <pre><code>  &lt;input type="submit" value="Submit" class="btn btn-primary"&gt;
  </code></pre>
  
  <p>If there is an error the submit button still works, i need it to show no error messages and then send, but i tried using the onsubmit for the form but its not working, it still submits even though the value is less and the error message is showing.</p>
  
  <p>This is the html.BeginForm. i think the error may be here. am not really sure.</p>
  
  <pre><code>         &lt;div class="modal-body"&gt;
          @using (Html.BeginForm("Save", "ReadingsEntry", FormMethod.Post, new { enctype = "multipart/form-data", onsubmit = "validateForm()" }))
          {
  </code></pre>
  
  <p>Any ideas</p>