jquery Formvalidator Plug-in Ajax verify content do not make any changes and leave the bug solution that prompts for errors _jquery

Source: Internet
Author: User

Query Formvalidator plug-ins are very useful, but there is a serious bug, in the use of AJAX verification, if the contents of the input box already exists, put the mouse into the input box, do not make any changes to leave, it will prompt the error, this is the plug-in made a very stupid mistake

Copy Code code as follows:

Oneisvalid:function (ID, index) {
var returnobj = new Object ();
Returnobj.id = ID;
Returnobj.ajax =-1;
Returnobj.errormsg = ""; Custom error messages
var Elem = $ ("#" + ID). Get (0);
var settings = elem.settings;
var settingslen = settings.length;
There's only one formvalidator, no test.
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.