x-ray
x-ray

Reputation: 3329

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.' });

But how do I remove this error? It is not removed when re-submitting and it is not removed when changing fields values.

Can I manually remove the message somehow, e.g. from onSubmit when re-submitting the form or after a timeout?

Upvotes: 0

Views: 1625

Answers (1)

Erik R.
Erik R.

Reputation: 7272

It's not super elegant, but you can do:

import { stopSubmit } from 'redux-form'

...

// remove all submit errors
dispatch(stopSubmit('formName', {}))

Upvotes: 1

Related Questions