Show errors on "onBlur", but immediately detect when form is valid? #4879
Unanswered
pgsandstrom
asked this question in
Q&A
Replies: 3 comments 2 replies
-
can you share a CSB? |
Beta Was this translation helpful? Give feedback.
1 reply
-
What did you end up doing? |
Beta Was this translation helpful? Give feedback.
1 reply
-
This is what I did. Before the first blur, no errors. Upon blur, errors shown. If the form is valid, const form = useForm<FormValues>({
resolver: zodResolver(formSchema),
mode: "onTouched",
defaultValues: {
accountId: "",
},
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
So I want my errors to show on "onBlur". But I want my "submit"-button to be enabled directly when the form is valid. Is there a neat way to achieve this?
For example, calling the ´trigger` function on each key press does enable my submit-button correctly, but it also shows errors prematurely.
Beta Was this translation helpful? Give feedback.
All reactions