Replies: 1 comment 2 replies
-
Take a look at #8065. I believe, it's the same type of usage question. I don't think RHF will provide |
Beta Was this translation helpful? Give feedback.
2 replies
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.
-
Would it be possible to inject current values/state (or both!) of form to validator functions, to make dynamic validations easier?
Let's assume we have form like this
and we only want the
bar
be required iffoo
is non-empty.Right now it would go like this
That works fine i guess, but it requires boilerplate and can only be done after the
useForm
hook has been initialized. I have made for our in-house use a utility that handles creating form and registering fields automatically from config, but in that config has no idea aboutwatch
etc. since it's initialized before theuseForm
.What if we could do something like this:
It would improve the UX, remove the need of having to watch the values and it could be accessed from anywhere.
Is something like this possible?
Beta Was this translation helpful? Give feedback.
All reactions