Access schema rules within Controller #10871
Unanswered
dominic-ast-axa
asked this question in
General
Replies: 1 comment
-
You can simply export your schema and re-import it in your components to access |
Beta Was this translation helpful? Give feedback.
0 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.
Uh oh!
There was an error while loading. Please reload this page.
-
I use react-hook-forms with schema validation (Zod) and MUI. Now a try to access the validation rules of the corresponding field within the "" tag, to "forward" them to the MUI-Component. For example: I would like to set required option in the MuiTextField, if the validation-rules for the corresponding field contain the required rule - which was derived from the Zod model. The same I try to achieve for things like max and min and other rules. Background is, that I try to have a single type model, which is used for validation but also for input restrictions. I did not yet figure out, out to do that - but it should be possible, I guess. I am also interessted in your approaches to achieve that goal. Thank you for any hint!
Best regards, Dominic
Beta Was this translation helpful? Give feedback.
All reactions