Difficulty with Handling a Variable Number of Inputs in Zod/Conform Form #408
Unanswered
kaitlyngreve
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I'm currently working on a Remix application where I'm using Zod for validation and Conform for form state management. In one of my forms, I'm encountering a challenge related to handling a variable number of inputs for connectionAccountNiceNames.
Here's a brief overview of the issue:
I have a form that allows users to customize connection information. One of the fields, connectionAccountNiceNames, can have a variable number of inputs. For some users, there might be 4 items, while others could have 7, 20, or any other variable amount.
I'm struggling with how to dynamically handle this variable number of inputs in the Zod schema and Conform form state. The relevant code snippet is as follows:
// Relevant code snippet
connectionAccountNiceNames: z.string().optional().array().optional()
I've tried a few approaches, but I'm not sure how to set up the Zod schema and Conform form state to accommodate this variability seamlessly.
Any guidance or examples on how to dynamically handle a variable number of inputs with Zod and Conform would be greatly appreciated.
Thanks in advance for your help
Beta Was this translation helpful? Give feedback.
All reactions