question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support one field required out of many validation

See original GitHub issue

Is 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
bluebill1049commented, Nov 20, 2020

I will ping on the board for a couple of weeks anyhow, see if other users have a similar request.

1reaction
Semigradskycommented, Dec 4, 2020

you will need to user trigger for dependent inputs

Thanks a lot!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found