Open olaoluwa-98 opened 5 years ago
Hello @olaoluwa-98
Yeah, will be nice to have such a feature. Couple of questions?
validateAll
is reserved, what should we call it?Hello @thetutlage, sorry for the late response.
I'm not sure what name can go with it. But I suggest that we accept an option on the validateAll
or validate
that will allow this feature. e.g In validate(data, rules, messages, options)
, the options object will accept the option for.
I'll start working on the PR.
For instance, if you have the following rules:
You may want the validation for
email
to stop on first error but continue to validate other fields such asphone_no
andpassword
which also will stop on first error of any rule item. I believe this feature will allow you to save time spent validating each item of a single rule.validateAll
continues to validate all fields including all the rules under each field. What I am proposing is a validate method that stops validation for each field on first error but continues to validate the other fields.I am willing to work on it but will need assistance.