[jQuery] [validate]jQuery plugin: Validation 1.4. Bug to support name array
I have several textbox with same name "liTitle[]". But when validate,
only the first one will be validate.
I search validatation's source code.
Here is the problem and my fix:
L404:
elements: function() {
var validator = this;
//
############################################################
// because all my textbox with same name, so
don't use this rulesCache here.
// And I don't know why we should use Cache
here. Seems useless
//
#############################################################
//rulesCache = {};
// select all valid inputs inside the form (no submit or reset
buttons)
// workaround $Query([]).add until http://dev.jquery.com/ticket/2114
is solved
return $([]).add(this.currentForm.elements)
.filter(":input")
.not(":submit, :reset, :image, [disabled]")
.not( this.settings.ignore )
.filter(function() {
!this.name && validator.settings.debug && window.console &&
console.error( "%o has no name assigned", this);
//
##################################################################
//remove below
// select only the first element for each name, and only those
with rules specified
//if ( this.name in rulesCache || !validator.objectLength($
(this).rules()) )
//
###################################################################
if ( !validator.objectLength($(this).rules()) )
return false;
//rulesCache[this.name] = true;
return true;
});
},