Jquery formValidator plug-in ajax verification content is not modified before leaving the bug prompt solution

Source: Internet
Author: User

The query formValidator plug-in is very useful, but there is a serious Bug. When ajax verification is used, if the content of the input box already exists, place the cursor in the input box and leave without any modification, an error will be prompted. This is a very stupid mistake made by the plug-in.

Copy codeThe Code is as follows: oneIsValid: function (id, index ){
Var returnObj = new Object ();
ReturnObj. id = id;
ReturnObj. ajax =-1;
ReturnObj. errormsg = ""; // custom error message
Var elem = $ ("#" + id). get (0 );
Var settings = elem. settings;
Var settingslen = settings. length;
// Do not check if there is only one formValidator
If (settingslen = 1) {settings [0]. bind = false ;}
If (! Settings [0]. bind) {return null ;}
For (var I = 0; I <settingslen; I ++ ){
If (I = 0 ){
If ($. formValidator. isEmpty (id )){
ReturnObj. isvalid = true;
ReturnObj. setting = settings [0];
Break;
}
Continue;
}
ReturnObj. setting = settings [I];
If (settings [I]. validatetype! = "AjaxValidator "){
$. FormValidator. triggerValidate (returnObj );
} Else {
ReturnObj. ajax = I;

Settings [I]. isvalid = true;
}
If (! Settings [I]. isvalid ){
ReturnObj. isvalid = false;
ReturnObj. setting = settings [I];
Break;
} Else {
ReturnObj. isvalid = true;
ReturnObj. setting = settings [0];
If (settings [I]. validatetype = "AjaxValidator") break;
}
}
Return returnObj;
},

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.