Possibility to reset form errors (_error) in redux-form 6.5.0
See original GitHub issueAre you submitting a bug report or a feature request?
If I understood the docs correctly, this is currently not possible. Thus a feature request.
What is the current behavior?
A form error can be set in onSubmit
with
throw new SubmissionError({ _error: 'My form error message.' });
When changing a value or re-submitting the form, the form error does not disappear, and there does not seem to be a way to (only) remove the form error manually (e.g. in onSubmit
).
What is the expected behavior?
It should be possible to remove/reset the form error message (_error
).
What’s your environment?
redux-form 6.5.0
Other informations
http://stackoverflow.com/questions/42288445/redux-form-6-5-0-how-to-clear-form-error-error
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
redux-form (6.5.0): How to clear form error (_error)?
It is easy to set a form error in onSubmit with throw new SubmissionError({ _error: 'My form error message.' });.
Read more >Synchronous Validation Example - Redux Form
IMPORTANT: Synchronous validation happens on every change to your form data, so, if your field value is invalid, your field.error value will always...
Read more >A practical guide to Redux Form - ERIK RASMUSSEN
Forms are hard in any framework, but they are extra complicated in React due to the recommended method of using "controlled inputs", ...
Read more >redux-form/stats.json - UNPKG
The CDN for redux-form. ... Users/erik/oss/redux-form/src/FieldArray.js", ... environment ' +\n 'for the full error message and additional helpful warnings.
Read more >simpler-redux-form - npm Package Health Analysis - Snyk
value - the initial value of the field. validate(value, allFormValues) : String — form field value validation function returning an error ...
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
Hi. We have the same issue, but found that dispatching the
stopSubmit
action with an empty errors object will clear it:https://github.com/erikras/redux-form/blob/e9bcc1b54e211071f0cefc644c1ab7b2e93b9d78/src/__tests__/reducer.stopSubmit.spec.js#L291
If submission is being blocked by async validation errors, then one can clear them with the
stopAsyncValidation
action creator:Why the
clear
property? The reducer branch for theSTOP_ASYNC_VALIDATION
action will only clear errors associated with a form if the payload has at least one key. It would be great if this behaviour could be changed in a backwards-compatible manner, but admittedly the codebase on which I’m currently working uses async validation for cases in which submission validation would be more appropriate; I have no idea why…