You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using useForm and a single yup schema to validate a form but the form is quite large so my schema is really long (~300 lines so far). I would like to separate parts of the schema based on the section they belong in but I'm not sure how to go about handling conditional validation in this case.
I want to conditionally require fields in other sections depending on the status field in section1 but when I separate it by section, I'm not able to refer to the status field from the other section.
An option I considered is getting the value of the status field via useField or useFieldValue and then returning a computed schema for the phone field depending on the status value but this seems like it would get messy quickly with many sections and fields.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using useForm and a single yup schema to validate a form but the form is quite large so my schema is really long (~300 lines so far). I would like to separate parts of the schema based on the section they belong in but I'm not sure how to go about handling conditional validation in this case.
My schema structure looks something like this:
I want to conditionally require fields in other sections depending on the status field in section1 but when I separate it by section, I'm not able to refer to the status field from the other section.
An option I considered is getting the value of the status field via useField or useFieldValue and then returning a computed schema for the phone field depending on the status value but this seems like it would get messy quickly with many sections and fields.
I'm also using custom input components like the example in the docs
https://vee-validate.logaretm.com/v4/guide/composition-api/custom-inputs/
Any advice on the best way to approach this would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions