Skip to content

Commit f13c43c

Browse files
committed
add validate onClick event to checkboxes & radios
save a few seconds of typing by defaulting this behavior, wrapped inside if case depending on new configuration value
1 parent 1b99b52 commit f13c43c

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
};
@@ -511,6 +518,7 @@
511518
*/
512519
validateOnEvent : true,
513520
validateOnBlur : true,
521+
validateCheckboxRadioOnClick : true,
514522
showHelpOnFocus : true,
515523
addSuggestions : true,
516524
modules : '',

0 commit comments

Comments
 (0)