I have used jQuery plugin: Validation
To validate some input fields, but I need to bypass validation when the user click the cancel button(which preforms a posts back)
Any help would be greatly appreciated Sp
I have used jQuery plugin: Validation
To validate some input fields, but I need to bypass validation when the user click the cancel button(which preforms a posts back)
Any help would be greatly appreciated Sp
Share Improve this question edited Jan 27, 2012 at 8:45 Mahmoud Gamal 80k18 gold badges142 silver badges168 bronze badges asked Jan 27, 2012 at 8:43 StevenSteven 2,2088 gold badges34 silver badges50 bronze badges2 Answers
Reset to default 5$("myButton").click(function () {
$("#mainform").validate().cancelSubmit = true;
$("#mainform").submit();
return false;
});
Actually I tried this and the answer is even simpler.
$("myButton").click(function () {
$("#mainform").validate().cancelSubmit = true;
});
The other two lines prevented my cancel button's submit action from working, so I whittled it down to just this one line and now it works great, validating on submit but not on cancel.
This allows my cancel button to submit the form with its Spring Web Flow event id regardless of the valid state of the form.