Automatically parse when using adapter after successful validation (Zod) #714
Unanswered
bennettdams
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
-
Hey!
Maybe I missed something, but is there a way or plans to automatically parse the form data after a successful validation?
Here's the Zod example, modified to alert the current raw value and parsed value:
https://stackblitz.com/edit/tanstack-form-7lnf2b?file=src%2Findex.tsx&preset=node
If you put in a number like
0123
, you can see that the value inonSubmit
is still0123
.When parsing that value, you'll get
123
.In other words, the validated data is not parsed with Zod.
PS: The same is true for Zod's
coerce
andtransform
, that's why my example shows both to demonstrate.Beta Was this translation helpful? Give feedback.
All reactions