validatorjs
validatorjs copied to clipboard
Error with multiple validation rules
I'm getting an error with '_getAttributeName' with more than one rule. I've managed to fix it with a simple change:
_getAttributeName: function(attribute) {
var name = attribute;
if (this.attributeNames.hasOwnProperty(attribute)) {
return this.attributeNames[attribute];
} else if (this.messages.attributes && this.messages.attributes.hasOwnProperty(attribute)) { //checked the attributes object first
name = this.messages.attributes[attribute];
}
if (this.attributeFormatter) {
name = this.attributeFormatter(name);
}
return name;
},
If you don’t mind, please supply a sample of your rules and associated data so we can better evaluate this issue