validatorjs icon indicating copy to clipboard operation
validatorjs copied to clipboard

Error with multiple validation rules

Open amunhoz opened this issue 4 years ago • 1 comments

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;
  },

amunhoz avatar Jan 20 '21 22:01 amunhoz

If you don’t mind, please supply a sample of your rules and associated data so we can better evaluate this issue

mikeerickson avatar Jan 20 '21 23:01 mikeerickson