-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Changes based on previous selections in a more complex form should allow an "update" or "add/remove" field validation.
It's not a "multistep" form exactly, but similar.
Select #1
- Option 1
- Option 2
- etc.
If Select #1 = Option 1, schema = option1Schema
If Select #1 = Option 2, Select #2
- Option 2.1
- Option 2.2
If Select #2 = Option 2.1, schema = option2.1Schema
If Select #2 = Option 2.2, schema = option2.2Schema
etc.
Currently, their doesn't seem to be any way of adding/removing schema fields or simply update the entire schema, dynamically, to the formHandler, since this only happens once, i.e.:
const formHandler = useFormHandler(zodSchema(schema));
Maybe this is already possible, but I haven't found a way since my requirements are to conditionally validate fields.
I've tried refine and superRefine for the Zod schema, but it just get's to complicated and doesn't really work.
Any thoughts/takers?