Using the jquery validate framework to verify the error resolution under IE8

Source: Internet
Author: User

Site backstage with the jquery validate framework, the version is jquery Validation Plugin 1.8.1

Because it took a long time, the new version has not been updated.

Recently the Company Information entry staff have adjusted, no IE11 browser, using IE8 error, error location as follows:

No. 688 Line error: name is null.

Find a lot of information, finally find the right solution as follows, found in the Jquery.validate.js file elements method, originally commented out this code:

1 if  This  in Rulescache | | !validator.objectlength ($ (this). Rules ()))2                     returnfalse;

Now uncomment it, as the code above means: Select only the first element that matches each name, and select only the elements that specify rules.

Without this code, all elements that do not specify rules will be validated, but most of them do not have name, which can cause the above problem. JS error causes unable to save.

Elementsfunction() {            varValidator = This, Rulescache= {}; //Select all valid inputs inside the form (no submit or reset buttons)            return$( This. Currentform). Find ("Input, select, textarea"). Not (": Submit,: RESET,: Image, [disabled]"). Not ( This. Settings.ignore). Filter (function() {                varElementidentification = This. ID | | This. Name; ! This. Name && validator.settings.debug && window.console && console.error ("%o has no name assigned", This); //Select only the first element for each name, and only those with rules specified                if( This. NameinchRulescache | | !validator.objectlength ($ ( This). Rules ()))return false; //Rulescache[this.name] = true;Rulescache[elementidentification]=true; return true;        }); },

Reference article:

Http://www.docin.com/p-908202951.html

Using the jquery validate framework to verify the error resolution under IE8

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.