You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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) advice.show();
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;
},
The text was updated successfully, but these errors were encountered:
I noted something odd going on in the
validateField
method in theFormValidator.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:
I used all the default options on the instantiations of
FormValidator.Tips
andFupdate.Prompt
, specifying the minimum necessary arguments.I noticed when I setup a
Fupdate.Prompt
with this form (after initializing theFormValidator.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 thevalidateField
method solved this behavior...but it is likely not the most elegant. It also removed a JS error I saw in console from themsgs.getChildren().hide()
line in this same method.Here's my sloppy but working changes:
The text was updated successfully, but these errors were encountered: