Skip to content

Commit eec73ef

Browse files
committed
prevent other event listeners on submit event when validation fails victorjonsson#372
1 parent bf774f1 commit eec73ef

33 files changed

+59
-49
lines changed

form-validator/brazil.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

form-validator/date.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

form-validator/file.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

form-validator/html5.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

form-validator/jquery.form-validator.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/** File generated by Grunt -- do not modify
1818
* JQUERY-FORM-VALIDATOR
1919
*
20-
* @version 2.3.22
20+
* @version 2.3.23
2121
* @website http://formvalidator.net/
2222
* @author Victor Jonsson, http://victorjonsson.se
2323
* @license MIT
@@ -998,38 +998,43 @@
998998
.unbind('blur.validation');
999999

10001000
// Validate when submitted
1001-
$form.bind('submit.validation', function () {
1001+
$form.bind('submit.validation', function (evt) {
10021002

1003-
var $form = $(this);
1003+
var $form = $(this),
1004+
stop = function() {
1005+
console.log('stopping');
1006+
evt.stopImmediatePropagation();
1007+
return false;
1008+
};
10041009

10051010
if ($.formUtils.haltValidation) {
10061011
// pressing several times on submit button while validation is halted
1007-
return false;
1012+
return stop();
10081013
}
10091014

10101015
if ($.formUtils.isLoadingModules) {
10111016
setTimeout(function () {
10121017
$form.trigger('submit.validation');
10131018
}, 200);
1014-
return false;
1019+
return stop();
10151020
}
10161021

10171022
var valid = $form.isValid(conf.language, conf);
10181023

10191024
if ($.formUtils.haltValidation) {
10201025
// Validation got halted by one of the validators
1021-
return false;
1026+
return stop();
10221027
} else {
10231028
if (valid && typeof conf.onSuccess === 'function') {
10241029
var callbackResponse = conf.onSuccess($form);
10251030
if (callbackResponse === false) {
1026-
return false;
1031+
return stop();
10271032
}
10281033
} else if (!valid && typeof conf.onError === 'function') {
10291034
conf.onError($form);
1030-
return false;
1035+
return stop();
10311036
} else {
1032-
return valid;
1037+
return valid ? true : stop();
10331038
}
10341039
}
10351040
})

form-validator/jquery.form-validator.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

form-validator/jsconf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** File generated by Grunt -- do not modify
22
* JQUERY-FORM-VALIDATOR
33
*
4-
* @version 2.3.22
4+
* @version 2.3.23
55
* @website http://formvalidator.net/
66
* @author Victor Jonsson, http://victorjonsson.se
77
* @license MIT

form-validator/lang/ca.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

form-validator/lang/cz.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

form-validator/lang/de.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)