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

[REQUEST] eitherOr validator #90

Open
andrejohansson opened this issue Oct 17, 2022 · 0 comments
Open

[REQUEST] eitherOr validator #90

andrejohansson opened this issue Oct 17, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@andrejohansson
Copy link

Is your feature request related to a problem? Please describe.
I would like to se a variant of the combined function that is "either field A or B should be valid"

Describe alternatives you've considered
Tried combining a hidden field and setting required on the combined field, and it works if all validation you need for the fields are "they exist" but not if you need any other validation per field:

const emailOrPhone = combined('emailOrPhone', [email, phone], ([email, phone]) => [email.value, phone.value].join(' '), [required()]); 

Additional context
Example: I would like either an email or a phone number to exist and be valid.

@andrejohansson andrejohansson added the enhancement New feature or request label Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants