0

Here's my form submission code:

$('#mainForm').submit();

All the solutions for disabling client side validation that I've seen have involved updating an attribute on the button that's pressed. But in my code there is no button press. The form is submitted using javascript.

How do I switch off client side validation on the client before submitting a form with code?

Ian Warburton
  • 15,170
  • 23
  • 107
  • 189
  • 1
    Related if not duplicate: http://stackoverflow.com/questions/203844/jquery-validation-plugin-disable-validation-for-specified-submit-buttons especially this answer : http://stackoverflow.com/a/2879499/872395 – nemesv Feb 12 '14 at 12:48
  • This worked... http://stackoverflow.com/a/2879499/221683 – Ian Warburton Feb 12 '14 at 14:48

2 Answers2

0

I hope I understand correctly, I make simple code for you,

If you want to stop submit, you can use return false in your javascript function.

check this fiddle : http://jsfiddle.net/mehmetakifalp/Z9Rw2/

$("#buttonForm").on('click', function(e){
    return false;
    $("#mainForm").submit();
});
mehmetakifalp
  • 445
  • 5
  • 16
  • Its not a button click but a drop down list change that's triggering the submission. Anyhow, I returned false from the handler but it still fires the validation. I checked the fiddle but it doesn't incorporate the validation library so its demonstrative power is somewhat diminished. – Ian Warburton Feb 12 '14 at 12:25
0

How do I switch off client side validation ?

try this

HtmlHelper.ClientValidationEnabled = false;
Nilesh Gajare
  • 6,302
  • 3
  • 42
  • 73