Skip to content

Commit e6c1ecc

Browse files
committed
Merge pull request victorjonsson#180 from stevewasiura/patch-6
add validate onClick event to checkboxes & radios
2 parents 2b074de + f13c43c commit e6c1ecc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

form-validator/jquery.form-validator.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@
106106
.bind('blur.validation', function() {
107107
$(this).validateInputOnBlur(language, settings, true, 'blur');
108108
});
109+
if(settings.validateCheckboxRadioOnClick) {
110+
// bind click event to validate on click for radio & checkboxes for nice UX
111+
this.find('input[type=checkbox][data-validation],input[type=radio][data-validation]')
112+
.bind('click.validation', function() {
113+
$(this).validateInputOnBlur(language, settings, true, 'click');
114+
});
115+
}
109116

110117
return this;
111118
};
@@ -522,6 +529,7 @@
522529
*/
523530
validateOnEvent : true,
524531
validateOnBlur : true,
532+
validateCheckboxRadioOnClick : true,
525533
showHelpOnFocus : true,
526534
addSuggestions : true,
527535
modules : '',

0 commit comments

Comments
 (0)