TanStackT
TanStack10mo ago
29 replies
wispy-olive

Form Validator onSubmit seems to be ignored if a field validator is also present

I'm not sure if this is a bug or an issue on my side but I have a weird behavior.

I have a onSubmit form validator to validate all my schema on submit. This work well.

Then I also want to have an onChange validator specific for field where I want to validate while the user type or blur. This also work on the field level.

But whenever I add the onChange validator to the field level, the onSubmit validator is not working anymore.

Here is a stackblitz to reproduce.

https://stackblitz.com/edit/tanstack-form-e1x8v1jk?file=src%2Findex.tsx

See the number field and try to comment the onChange validator.

Am I missing something?
What I would expect, is that on the first submit, the errors would be displayed.
Was this page helpful?