Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix elementValidate event not being fired on hidden elements #1152

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+5 −3
Split
@@ -148,8 +148,10 @@ Form.Validator.Inline = new Class({
var props = field.get('validatorProps');
//Build advice
if (!props.msgPos || !document.id(props.msgPos)){
- if (field.type && field.type.toLowerCase() == 'radio') field.getParent().adopt(advice);
- else advice.inject(document.id(field), 'after');
+ if(field.isVisible()) {
+ if (field.type && field.type.toLowerCase() == 'radio') field.getParent().adopt(advice);
+ else advice.inject(document.id(field), 'after');
+ }
} else {
document.id(props.msgPos).grab(advice);
}
@@ -258,7 +258,7 @@ Form.Validator = new Class({
if (warn != null) warn = false;
if (this.hasValidator(field, 'warnOnly')) warn = true;
var isValid = this.hasValidator(field, 'ignoreValidation') || (validator ? validator.test(field) : true);
- if (validator && field.isVisible()) this.fireEvent('elementValidate', [isValid, field, className, warn]);
+ if (validator) this.fireEvent('elementValidate', [isValid, field, className, warn]);
if (warn) return true;
return isValid;
},