Validation of dependent fields / compound validations #10843
Unanswered
gdfreitasdev
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I sometimes get into a situation where I need to manually trigger a field validation because its rules was invalided by another field.
I'll give an example:
For some reason the schema validator is returning the invalid field but it does not propagate/update formState the errors
After some research in the community I realized that it requires manually calling
trigger(sideEffectField)
. That can be done either by having anuseEffect
in watched current values or by imperatively calling trigger duringonChange
callbacks.I tried with both Zod and Joi resolvers, so it doesn't seems to be something related to the resolvers.
How do you approach this situation? I'd say an solution for this will be appreciated in the official docs.
Beta Was this translation helpful? Give feedback.
All reactions