validate on submit then on change
- User enter values into form
- User pressed submit
- Any invalid fields show their errors
- First invalid field gets focused
- Validation is re checked on every change
This is how react hook form works, but I can't seem to emulate it in tanstack form and I can't see anything I am doing wrong from docs.
I have tried using
onSubmit validator, but that removes the error as soon as a key is pressed. If I keep an invalid value and press submit, it focuses the field again but doesn't show the error. Also, if I then enter a valid value and have another field no valid, then pressing submit again doesn't focus the next field.I have tried using
onChange but that shows validation errors immediately.What I am really looking for is an
onSubmitThenChange option. If they have tried to submit the form and are struggling, we should help them out as much as possible. I tried using onChange and then ignoring errors until submissionAttemps > 0 but that still had weird effects.Attached is code snippets in thread.