Home > Web Front-end > JS Tutorial > The jquery formValidator plug-in ajax validation method leaves the error prompt without making any changes to the content_jquery

The jquery formValidator plug-in ajax validation method leaves the error prompt without making any changes to the content_jquery

WBOY
Release: 2016-05-16 17:44:32
Original
957 people have browsed it

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

Copy the code The code is as follows:

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;
},
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template