Field has error but is still valid
See original GitHub issueHey there, thanks for this great library! Everything worked perfectly so far, except now I have a very strange behavior for a text field that has errors (they are even shown in the form correctly) but still validates to true
and the onSuccess
handler is called on the form.
Here is a screenshot of the console.log output of the form.get
call for this field:
I guess this state (errors are set & displayed but field hasError
is false
) should not be possible?
It worked fine on a form where we used material-ui and now im trying it with react-toolbox although i don’t think that is the problem?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Why is an Angular form VALID with no mat-error when it has ...
1. When I set an error via the customValidator on the form, the form.status remains VALID even when there are form.errors ...
Read more >How to Troubleshoot and Fix Excel Pivot Table Errors
The pivot table error, "field name is not valid", usually appears because one or more of the heading cells in the source data...
Read more >Form-Field Validation: The Errors-Only Approach
With all form fields still displayed (valid or not), the user might have difficulty identifying the few erroneous fields among the many valid...
Read more >Solved: If Validation and Error Message Issue
Solved: Hi, I am trying to validate the below code, not getting required output. Here I am validating either the user has uploaded...
Read more >forms: validation. don't show errors until the user has had a ...
When a user opens a page that has a bunch of required fields, all they see is a bunch of red. Not very...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @foxhound87. We where using react-intl and our validators where returning an object instead of a string for validation errors. This was causing the issue.
From @DominikGuzei’s example:
messages.invalidWalletName
was an object:And it needed to be a string so the fix was to provide a validator with i18n features of
react-intl
to return a string for validation error instead of passing an object.I don’t know how react-intl work, I never used it. You can try to use stateless components if you are using classes with local state. If you can setup a small test project I will take a look.