Describe the bug#
onBlur validation is showing a validation message for a required field when the field is not blank
Your minimal, reproducible example#
https://stackblitz.com/edit/tanstack-form-jxykqf4t?file=src%2Findex.tsx&preset=node
Steps to reproduce#
- Click into the first name input
- Tab into the last name input
- Start typing into the last name input
- The "lastname required" message is display
Expected behavior#
I would not expected the "lastname required" message to be displayed when the field is not empty.
How often does this bug happen?#
Every time
Screenshots or Videos#
https://github.com/user-attachments/assets/189d939f-1d0c-47c1-a11f-04cabe827816
Platform#
Windows, Chrome 137
TanStack Form adapter#
react-form
TanStack Form version#
1.12.3
TypeScript version#
5.8.3
Additional context#
No response
What's happening is the combination of form-level validation and the
onBlurevent.Here's a description of your "steps to reproduce":
onBlurvalidation event.onBlurvalidator is run. It creates errors forFirst NameandLast NameFirst Nameis touched so it will show the error.Last Nameis not touched so it won't show the error. 3. Start typing into the last name inputLast Nameis now touched.To summarize, this is intended behaviour. The fix depends on what you actually want the behaviour to be, as
onBlurvalidation only runs on blur.