Skip to content
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

Option to trigger onSubmitInvalid on every submit #1109

Open
beeirl opened this issue Jan 10, 2025 · 1 comment
Open

Option to trigger onSubmitInvalid on every submit #1109

beeirl opened this issue Jan 10, 2025 · 1 comment

Comments

@beeirl
Copy link

beeirl commented Jan 10, 2025

Description
Currently, onSubmitInvalid is designed to be called only once, due to this line of code. This behavior limits flexibility for handling invalid form submissions, as it prevents custom logic from being executed during validation.

Use Case
I want to implement functionality where, if the form is resubmitted, the next field that still has an error gets focused. However, since onSubmitInvalid is only called once, this behavior isn't currently possible without workarounds.

Proposal
Remove the guard to allow onSubmitInvalid to be called multiple times, or provide an explicit option to opt out of the current restriction.

@origamisage
Copy link

I just ran into the same issue when trying to integrate Tanstack Form with React Aria Components.
My use case is exactly the same as described above - managing focus on invalid states. This is indeed possible with some "hacky" workarounds but being able to run the logic inside onSubmitInvalid would make things a lot cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants