Support one field required out of many validation
See original GitHub issueIs your feature request related to a problem? Please describe. At the moment there is only validation for specific fields. It would be amazing if somehow you could add validation based off other inputs.
For example:
Email
Phone
Only one of them is required. If you fill in Email
then Phone
is not required.
Describe the solution you’d like
Right now validation is added part of register
. Possibly add an extra field like mode
to the useForm
hook and call it validation
.
Describe alternatives you’ve considered
I think something similar is possible using getValues
and comparing them. But this would be a great addition to the great library react-hook-form is.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (6 by maintainers)
Top Results From Across the Web
jQuery Validate plugin : Only one field required out of multiple
The rules do not seem to work at all, where both fields are always required. 2) There is a require_from_group rule included in...
Read more >Restrict data input by using validation rules
You can compare values across different fields using a record validation rule. For example, a record with two date fields might require that...
Read more >Two fields required when opportunity is in specific stages
Need help writing a validation rule - TCV and ACV fields are REQUIRED for Stage = Solution Design, Proposal, Negotiate and Commit for...
Read more >Multiple Fields Required in Form Validation
The only requirement is that the fields cannot both be empty at the same time. So, it's okay for one field to be...
Read more >Required Field Validation
I am having a problem with clients not filling out the intake forms through the client portal. Some clients fill in the required...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I will ping on the board for a couple of weeks anyhow, see if other users have a similar request.
Thanks a lot!