From 4f40bb535e60c601ee2151bad161a9675c1505d2 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 8 Dec 2016 15:19:50 +0530 Subject: [PATCH 1/3] Fixed validation for name array within form. If a form input has a name="xyz[]" then only first element with name="xyz[]" is validated and rest are ignored. --- src/core.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core.js b/src/core.js index e9d17db86..66025879c 100644 --- a/src/core.js +++ b/src/core.js @@ -436,8 +436,15 @@ $.extend( $.validator, { checkForm: function() { this.prepareForm(); - for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) { - this.check( elements[ i ] ); + for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) { + //Fix validation for name array within form + if (this.findByName( elements[i].name ).length != undefined && this.findByName( elements[i].name ).length > 1) { + for (var cnt = 0; cnt < this.findByName( elements[i].name ).length; cnt++) { + this.check( this.findByName( elements[i].name )[cnt] ); + } + } else { + this.check( elements[i] ); + } } return this.valid(); }, From 53d7c2a0665a79ec0376625e1535d22f68f0091f Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Tue, 11 Jul 2017 12:48:31 +0530 Subject: [PATCH 2/3] Incorporated JSCS linting --- src/core.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core.js b/src/core.js index 66025879c..020e9a8e9 100644 --- a/src/core.js +++ b/src/core.js @@ -436,14 +436,15 @@ $.extend( $.validator, { checkForm: function() { this.prepareForm(); - for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) { + for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) { + //Fix validation for name array within form - if (this.findByName( elements[i].name ).length != undefined && this.findByName( elements[i].name ).length > 1) { - for (var cnt = 0; cnt < this.findByName( elements[i].name ).length; cnt++) { - this.check( this.findByName( elements[i].name )[cnt] ); + if ( this.findByName( elements[ i ].name ).length !== undefined && this.findByName( elements[ i ].name ).length > 1 ) { + for ( var cnt = 0; cnt < this.findByName( elements[ i ].name ).length; cnt++ ) { + this.check( this.findByName( elements[ i ].name )[ cnt ] ); } } else { - this.check( elements[i] ); + this.check( elements[ i ] ); } } return this.valid(); From 8f9c1c4d702c0f971869cdb2ec4dda0f183d03bd Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Tue, 11 Jul 2017 13:00:34 +0530 Subject: [PATCH 3/3] Incorporated JSCS linting --- src/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.js b/src/core.js index 020e9a8e9..890441ac9 100644 --- a/src/core.js +++ b/src/core.js @@ -437,7 +437,7 @@ $.extend( $.validator, { checkForm: function() { this.prepareForm(); for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) { - + //Fix validation for name array within form if ( this.findByName( elements[ i ].name ).length !== undefined && this.findByName( elements[ i ].name ).length > 1 ) { for ( var cnt = 0; cnt < this.findByName( elements[ i ].name ).length; cnt++ ) { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy