Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

form-and-data-validation-with-zod #4

Open
utterances-bot opened this issue Jan 12, 2022 · 2 comments
Open

form-and-data-validation-with-zod #4

utterances-bot opened this issue Jan 12, 2022 · 2 comments

Comments

@utterances-bot
Copy link

Form and data validation with ZOD

Remix brings us back to the olden days of web development by relying on web fundamentals. In practice, this means leaving it to the browser to do t...

https://remix-cookbook.com/form-and-data-validation-with-zod

Copy link

Awesome! Thanks a lot!

Copy link

docgecko commented Feb 3, 2022

Hey Fabio, great to see someone using zod to validate forms in Remix, thank!

I have a question regarding how you access the errors in the form. How do you handle a situation where the "name" field has no error and the "email" has an error? Zod would return an array of one error, with the error at issue location [0]. This would be picked up by name in your form, rather than email, as you have used actionData?.error?.issues[0].message. Is there a better way of accessing the issue for the form field name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants