Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions Source/Forms/Form.Validator.Inline.js
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Forms/Form.Validator.js
Expand Up @@ -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;
},
Expand Down