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
Add a way to display only one error for a field #667
Comments
This should be done at the validator level where you can pass Will mark this as "Good first issue" and a feature request |
@crutchcorn Hello, can I work on this issue? If possible, please assign it to me. 😊 |
Not sure if this is relevant to this issue or if I should create a separate one but being able to return an array from validators={{
onChange: ["err1", "err2"] // string | string[]
}} instead of having to return a single |
Describe the bug
Currently we return
field.state.meta.touchedErrors
ValidationError[]
as a string by concataining the different errors of a field with commas.It would be great to be able to display only one error.
e.g:
These valibot validators will end up on showing all three errors just by typing a letter and deleting it.
Imo, this is not a good UX.
I would expect some kind of priority in the error messages, thus only displaying the first validation to return an error.
Your minimal, reproducible example
https://github.com/TanStack/form/
Steps to reproduce
Expected behavior
More control over the errors display
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
macOS
TanStack Form adapter
react-form
TanStack Form version
0.19.0
TypeScript version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: