You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Let's imagine I'm developing a component with a field in which, for whatever reason, I can't use global rules. The component has the rules locally defined or are passed as props. Let's assume the component should validate more than one rule but it also needs expose all the errors from this validation if bails is false.
I know I can define my own function to chain this non global rules and return an error message as a rule fails.
Is it possible to set more than one error and respect bails behavior inside a GenericValidateFunction?
Describe the solution you'd like
Accepting a chain of validation functions as rules:
Is your feature request related to a problem? Please describe.
Let's imagine I'm developing a component with a field in which, for whatever reason, I can't use global rules. The component has the rules locally defined or are passed as props. Let's assume the component should validate more than one rule but it also needs expose all the errors from this validation if bails is false.
I know I can define my own function to chain this non global rules and return an error message as a rule fails.
Is it possible to set more than one error and respect bails behavior inside a GenericValidateFunction?
Describe the solution you'd like
Accepting a chain of validation functions as rules:
In this case, if value is not set and I run validation I would expect errors to be:
If I set bails to true, validation would stop on the first rule that fails, for the same example errors would be:
The order of evaluation of the rules follows the order of the specified chain.
Describe alternatives you've considered
I currently can bypass this issue using global rules. Not sure about validation order though.
The text was updated successfully, but these errors were encountered: