jQuery Validate checks the method of multiple identical NAME

There is a code in the form

         jQuery validate only checks the first INPUT box when multiple identical NAME checks. 

In the JS corresponding to the table, only the following code can only solve multiple NAME check

IF ($ .validator) {$ .validator.prototype.elements = function () {var validator = this, rulescache = {}; returnid $ (“INPUT) .find. Select, textarea “) .NOT (“: submit,: reset,: image, [disabled] “) .NOT (this.settings.ignore) .filter (function () {if (! this.name && validator.settings. Debug && window.console) {Console.Error (“% o Has no name assigned”, this);} rulescache [this.name] = true; return true;};}}

  Solution 2: 
Modifying the source files All pages can verify multiple Name

way 1: Modify jQuery.validate.js file

Find this.name in rulescache with ctrl + f to comment out of the following code.

Elements: function () {var validator = this, rulescache = {}; // select all valid INPUTS INSIDE THE FORM (No Submit Or Reset Butt “Return $ This.currentform) .find (“INPUT, SELECT, TEXTAREA”) .NOT (“: Submit,: Reset,: image, [disabled]”) .NOT (this.settings.ignore) .filter (function () {i (! this.name& Validator.Settings.debug && window.console) {Console.Error (“% o Has no name assigned”, this);} // Note Fall here // select Only The First Element for Each Name, And Only Those with rules specified //iff (this.name in rulescache ||! validator.ObjectLength ($ (this). Rules ())) {// Return False; //} rulescache [this.name] = true; return true;});},

Method 2: Modify jQuery.validate.min.js file
   Look with Ctrl + F (C [this.name] =! 0,! 0)}) 

Return! This.name && B.Settings.debug && Window.console && console.Error (“% o Has no name assigned”, this), // this.name in c ||! B.ObjectLength A (this) .Rules ())?! 1: (c [this.name] =! 0,! 0) // Note this line C [this.name] =! 0,! 0 // Add this line

The above is the method of jQuery Validate, which is introduced to you, I hope to help everyone, if you have any questions, please give me Message, the small package will reply to everyone in time. Thank you very much for your support of Tumi Cloud Website!
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment