The query formValidator plug-in is very easy to use, but there is a serious bug. When using ajax verification, if the content of the input box already exists, put the mouse into the input box and leave without making any modifications, an error will be prompted. , This is a very stupid mistake made by this plug-in
oneIsValid: function(id, index) {
var returnObj = new Object();
returnObj.id = id;
returnObj.ajax = -1;
returnObj.errormsg = ""; / /Customize error message
var elem = $("#" id).get(0);
var settings = elem.settings;
var settingslen = settings.length;
//Only When a formValidator is used, it is not checked
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;
},
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn