Form.Validator.inline does not reset hidden field validation errors #1111

Open
msheehan79 opened this Issue Mar 22, 2012 · 0 comments

Comments

Projects
None yet
1 participant

msheehan79 commented Mar 22, 2012

I have noticed that if a form has a validation error occur with an input that later becomes hidden, the error does not disappear. So if based on conditional data some parts of the form disappear, if any of those now hidden inputs had a validation error the error message will persist because the field is no longer being validated.

Not sure if the below is the best approach but I added a workaround in the test function of Form.validator to call the resetField method to remove the error message from the stack if a hidden field is detected.

test: function(className, field, warn){
    field = document.id(field);
             // Updated this section to resetField before return true
    if ((this.options.ignoreHidden && !field.isVisible()) || (this.options.ignoreDisabled && field.get('disabled'))) { 
        this.resetField(field);
        return true;
        }
    var validator = this.getValidator(className);
    if (warn != null) warn = false;
...


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment