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;
},