Skip to content


Subversion checkout URL

You can clone with
Download ZIP


FormValidator.Tips and serial validation #33

dci2112 opened this Issue · 0 comments

1 participant


I noted something odd going on in the validateField method in the FormValidator.Tips class.

Test case: create a multi text field form. Introduce multiple validations on some of the fields, and have at least 2 that have no "required" validations. My example had the following 5 text field validations:

  • required validate-integer
  • required minLength:10
  • validate-url
  • validate-url
  • validate-url

I used all the default options on the instantiations of FormValidator.Tips and Fupdate.Prompt, specifying the minimum necessary arguments.

I noticed when I setup a Fupdate.Prompt with this form (after initializing the FormValidator.Tips ) that if I failed the first field (enter alpha chars) and the second field (enter too few chars) then corrected the first field I could post the form even though the second field still was invalid. Another behavior was that if I had a correct integer entry in field one, a too short entry in field 2, then clicked around in fields 3 through 5 I could make the error tip go away on field 2, and post.

I found the following changes to FormValidator.Tips in the validateField method solved this behavior...but it is likely not the most elegant. It also removed a JS error I saw in console from the msgs.getChildren().hide() line in this same method.

Here's my sloppy but working changes:

    validateField: function(field, force){
        var advice = this.getAdvice(field);
        var anyVis = this.advices.some(function(a){ return a.visible; });       
        if (anyVis && this.options.serial) {
            if (advice && advice.visible) {
                var passed = this.parent(field, force);
                if (!field.hasClass('validation-failed')) advice.hide(); 
            return passed;
        var msgs = field.retrieve('validationMsgs');
        if (msgs) {
            var msgChildren = msgs.getChildren();
            msgChildren.each(function (item,index) { item.hide(); });
        if (field.hasClass('validation-failed') || field.hasClass('warning')) if (advice);
        var passed = this.parent(field, force);

        if (this.options.serial && !passed) {
            var fields = this.element.getElements('.validation-failed, .warning');
            if (fields.length) {
                fields.each(function(f, i) {
                    var adv = this.getAdvice(f);
                    if (adv) adv.hide();
                }, this);
                passed = this.parent(field, force);

        return passed;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.