#How to use qwik form and zod with an array of custom objects

5 messages · Page 1 of 1 (latest)

blissful rain
#

I am trying to validate a form which has an array of custom objects on it but I can't get zod to see the array of objects.

Attached is my zod validation and my html inputs. I have tried passengers.0.firstname and passengers[0].firstname. With the first one it says it expected an array and got an object but with the second one it says it got undefined.

Has anyone managed to get this to work?

unborn salmon
#

I don't believe arrays of object is currently supported by the formData parser.

blissful rain
#

That seems like a pretty big thing to be missing :(. Any ideas when it might arrive?

honest mortar
unborn salmon
#

I'm pretty sure arrays of objects aren't native to html forms, so things have to be "invented". I'm sure the team would happily accept a PR that added support for them.