WizardFormFunnel: Changing Yup Schema based on view #2032
-
|
Using this: https://react-hook-form.com/advanced-usage#WizardFormFunnel and assigning basic react-hook-form validations as part of <input ref={register({ required: true, maxLength: 30 })}> for example work great and don't try to validate fields that are not in display. But switching to the new yupResolver(schema) as documented here: https://react-hook-form.com/api/#useForm The (schema) passed in is for the whole wizard, and tries to validate every field on step 1 of the wizard. Question is: How to use yupResolver(schema) for WizardFormFunnel? For example is there a way to tell react-hook-form to use a different schema for each section of the wizard? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
probably would be easier to use custom resolved? so you can have 3 pages of schema inside of the |
Beta Was this translation helpful? Give feedback.
-
|
Turns out I was overcomplicating things. I had useForm() on Moved useForm() to each step and now everything is simple. The right schema is loaded on each step. |
Beta Was this translation helpful? Give feedback.
Turns out I was overcomplicating things. I had useForm() on
<App />and was passing it down to the steps as a prop.Moved useForm() to each step and now everything is simple. The right schema is loaded on each step.