Closed jacobsamo closed 1 year ago
Please share how you've solved it? I am running into the same issue.
Please share how you've solved it? I am running into the same issue.
Amateur! You obviously need to pass both the onvalid and oninvalid arguments to useForm().handleSubmit(onvalid, oninvalid)
. Not providing all required fields from a schema is an invalid submission, hence your onvalid callback won't run...
What version of
drizzle-orm
are you using?0.28.6
What version of
drizzle-kit
are you using?0.19.13
Describe the Bug
When using
drizzle-zod
to generate schemas from database schemas and using them in theuseForm
resolvers the onSubmit won't fire at all for some reason,So for example:
and then using it in the
useForm
in this example when you click the
Submit
from the form it doesn't work at all.however if you build your own schema using zod it works fine.
For reference this was working about a about a week ago.
No errors show in the browser console or terminal, so i don't know what is up there
I have posted an duplicate issue with the
react-hook-form
team however I'm not sure which team is that the problem is coming from like to issue: https://github.com/react-hook-form/resolvers/issues/642To Reproduce Steps to reproduce the behavior:
drizzle-zod
andcreateInsertSchema
useForm
resolvertry submitting the form (should not work)
Codesandbox link very simple application that doesn't seem to submit: https://codesandbox.io/p/sandbox/react-hook-form-zod-resolver-not-working-9c7qn9
Expected behavior
When submitting the form the
onSubmit
handler is called and all code withing this function runswithinEnvironment & setup
Operating systems that is is occuring in:
Browsers:
Versions of packages:
react-hook-form
: 7.47.0@hookform/resolvers
: 3.3.2drizzle-orm
: 0.28.6drizzle-zod
: 0.5.1drizzle-kit
: 0.19.13