#Set error when onSubmit fails
7 messages · Page 1 of 1 (latest)
until createErroris added in, the easiest way is to have your endpoint call in validators.onSubmitAsync.
If the endpoint succeeded, return nothing.
If the endpoint threw validation errors, return those errors.
Don't blame the user for random server errors. They can't submit with errors present.
Thanks.. The use case here is not to handle random server errors, it's to present actual errors correctly to the user. The current use case i have is to validate the uniqueness of an email address. I haven't looked into the async validators that much (the documentation is a bit lacking sadly)
By providing an Endpoint that tells anonymous users if an entered E-Mail-Address is unique you're possibly giving away the information if a user with this address is registered on your app/site/service which could be missused.
There's some WIP docs regarding error handling here: https://github.com/TanStack/form/pull/1566/files
I'm using react server actions, so this should not be an issue...
Let's say you are running some-shady-site.tld and I want to know if my colleague is registered there (I know their e-mail).
I go go your site, enter their mail and your endpoint will respond with this e-mail is not unique
Then I know that colleague is registered with your site, right?