Unable to clear errors set by updateInputsWithError on other fields or the whole form
See original GitHub issueI have a login page with a username and password. The end goal is that I would like to clear the “externalErrors” when any field is updated, not just the password field.
Given a component with a Formsy form:
- Submit the form
- Dispatch a redux action
- Redux logic/thunk calls the API server to login and dispatches an error
- Props on the component are updated and
updateInputsWithError
is invoked on password with the error - Change the value in the password field and the error clears
- Change the value of username
What I would like to be able to do at this point is to clear the error in the password field when the username field is changed. The only place that I found that resets the externalError
is here:
https://github.com/formsy/formsy-react/blob/v1.1.4/src/index.js#L272-L287
That function is called in three spots in Wrapper.js https://github.com/formsy/formsy-react/blob/master/src/Wrapper.js#L100 https://github.com/formsy/formsy-react/blob/master/src/Wrapper.js#L142 https://github.com/formsy/formsy-react/blob/master/src/Wrapper.js#L167
~I’ve been looking for a work around but I can’t seem to figure one out.~
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
Any thoughts on this from the contributors? @rkuykendall @rubencosta @MilosRasic
Thanks.
This has been fixed in the new 2.0.0 release. The new added function is
formsy.updateInputsWithValue
and it works very similarly toupdateInputsWithError
.Please re-open this ticket or create a new one if I am mistaken.
v2.0.0
getErrorMessage()
=>errorMessage
getErrorMessages()
=>errorMessages
getValue()
=>value
hasValue()
=>hasValue
isFormDisabled():
=>isFormDisabled
isFormSubmitted()
=>isFormSubmitted
isPristine()
=>isPristine
isRequired()
=>isRequired
isValid():
=>isValid
showError()
=>showError
showRequired()
=>showRequired
https://github.com/formsy/formsy-react/compare/v1.1.4...v2.0.0