form
form copied to clipboard
`canSubmit` is always `true` on first render of form
Describe the bug
I am using a form with the zodValidator and have several field-level validations. On the first render the canSubmit property is true even though several fields are invalid. After changing the first input the validations run and canSubmit is invalid.
Your minimal, reproducible example
https://tanstack.com/form/latest/docs/framework/react/examples/zod
Steps to reproduce
- Go to the official zod example
- The
Submitbutton is enabled even though the firstName has a minLength validation of 3 - Type something in any of the fields
- The
Submitbutton is disabled until all the validations are correct
Expected behavior
I would expect that the canSubmit property considers all validations on the first render and shows a disabled Submit 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