validatorjs icon indicating copy to clipboard operation
validatorjs copied to clipboard

Detect which rule not passed?

Open alisherafat01 opened this issue 7 years ago • 2 comments

How can i detect which rule is not passed? `

      for (let field in v.errors.all()) {
        fields.push({
          field,
          value: data[field],
          message: v.errors.first(field),
          rule: 'not passed rule' /// what to write here?
        })
      }


alisherafat01 avatar Feb 28 '18 10:02 alisherafat01

@alisherafat In an upcoming release, we are going to adjust how it validator returns objects to match that which Laravel is doing.

mikeerickson avatar Feb 28 '18 16:02 mikeerickson

Was this feature implemented?

I'm in a position where knowing the name of the rule that failed is vital.

MrClyfar avatar Jan 16 '19 10:01 MrClyfar