Reputation: 3696
Redux Form validation examples only include individual field validations.
Having a list of a certain number of fields that are the same, how can I model a validation that requires at least one of the inputs to be a valid email address?
For example, for the given form made up of the following fields:
How can I write a validation function that requires Special User 4 to always be set, and either one of the first 3 users?
Upvotes: 8
Views: 5128
Reputation: 7272
Your synchronous validation function is given all the values of the form. Your errors must correspond to a field key, or you can use the generic _error
key, which will result in this.props.error
being populated.
Does that make sense?
Upvotes: 11