Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for stopping validation on first error per field #250

olaoluwa-98 opened this issue Aug 19, 2019 · 2 comments


Copy link

commented Aug 19, 2019

For instance, if you have the following rules:

    email: 'required|email|unique:users,email',
    phone_no: 'required|unique:users,phone_no',
    password: 'required|min:8'

You may want the validation for email to stop on first error but continue to validate other fields such as phone_no and password 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.

@olaoluwa-98 olaoluwa-98 changed the title Support for stopping validation on first error for per field Support for stopping validation on first error per field Aug 19, 2019

This comment has been minimized.

Copy link

commented Aug 22, 2019

Hello @olaoluwa-98

Yeah, will be nice to have such a feature. Couple of questions?

  1. What should be the name of property? Since validateAll is reserved, what should we call it?
  2. Can you start working on the PR and just ping me, if you get stuck somewhere?

This comment has been minimized.

Copy link

commented Aug 23, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.