Bypass validation for buttons with 'formnovalidate' attribute (same as class="cancel"). Closes gh-623

This commit is contained in:
Paul Cichonski
2013-02-04 12:25:08 -08:00
committed by Jörn Zaefferer
parent ff26f320c6
commit bcff73ad84
3 changed files with 42 additions and 0 deletions

5
jquery.validate.js vendored
View File

@@ -45,6 +45,11 @@ $.extend($.fn, {
if ( $(event.target).hasClass("cancel") ) {
validator.cancelSubmit = true;
}
// allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
if ( $(event.target).attr("formnovalidate") !== undefined ) {
validator.cancelSubmit = true;
}
});
// validate the form on submit