-
-
Notifications
You must be signed in to change notification settings - Fork 323
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
canSubmit
is always true
on first render of form
#723
Comments
Hey! The current behavior in the example seems correct to me, the validator is triggered What you're trying to achieve might be validating With that said, if we agree that An alternative option could be to manually run |
** I figured out the solution for
|
Not sure what the answer is here but I also encountered this same behaviour and find it confusing. I validate my fields I would've expected that disabling the "Submit" button based on |
Describe the bug
I am using a form with the
zodValidator
and have several field-level validations. On the first render thecanSubmit
property is true even though several fields are invalid. After changing the first input the validations run andcanSubmit
is invalid.Your minimal, reproducible example
https://tanstack.com/form/latest/docs/framework/react/examples/zod
Steps to reproduce
Submit
button is enabled even though the firstName has a minLength validation of 3Submit
button is disabled until all the validations are correctExpected behavior
I would expect that the
canSubmit
property considers all validations on the first render and shows a disabledSubmit
button from the start instead of changing from enabled to disabled after typing one letter and going back to enabled after all validations are correct.How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
OS: MacOS
Browser: Arc
TanStack Form adapter
react-form
TanStack Form version
0.20.2
TypeScript version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: