Closed Stf-F closed 8 months ago
When validating, the messages are passed to the form using the name
property: https://ui.nuxt.com/components/form#error-event
So when you have a state with nested values the name should look like so: <FormGroup name="parent.nestedValue">
When validating, the messages are passed to the form using the
name
property: https://ui.nuxt.com/components/form#error-event So when you have a state with nested values the name should look like so:<FormGroup name="parent.nestedValue">
I did see that but did not connect the dots. It does work indeed. The docs could use an example with nested structures I suppose. Thanks @Gerbuuun 👍
Environment
But also reproduced on Stackblitz with:
Version
2.14.2
Reproduction
The repo with the repro: https://stackblitz.com/edit/nuxt-starter-c7fdv5?file=schemas%2Findex.ts,app.vue,nuxt.config.ts,pages%2Findex.vue
Description
I have a complex form where I compose several zod schemas together to create a final validation schema. I have tried using
.object
and.extend
and I always come to the same conclusion, nested schemas with nested reactive properties are not validated. This will not be validated at all:With the following state :
And this will only validate the properties of the FooSchema as they sit at the root, but
bar
validation will not work.With :
This is really tricky and causing me a ton of grief. Nested data structures are not uncommon in forms and it would be really nice to get support for this.
Thanks,
Additional context
No response
Logs
No response