question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to clear errors set by updateInputsWithError on other fields or the whole form

See original GitHub issue

I 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:

  1. Submit the form
  2. Dispatch a redux action
  3. Redux logic/thunk calls the API server to login and dispatches an error
  4. Props on the component are updated and updateInputsWithError is invoked on password with the error
  5. Change the value in the password field and the error clears
  6. 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:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
djensen47commented, May 29, 2019

Any thoughts on this from the contributors? @rkuykendall @rubencosta @MilosRasic

Thanks.

0reactions
rkuykendallcommented, Feb 3, 2020

This has been fixed in the new 2.0.0 release. The new added function is formsy.updateInputsWithValue and it works very similarly to updateInputsWithError.

Please re-open this ticket or create a new one if I am mistaken.

v2.0.0

  • Much, much faster
  • Many, many bug fixes
  • Full Typescript typing
  • Fixed deprecated lifecycle methods
  • Updated all libraries
  • Fixed a number of legacy decisions in the Formsy API, mostly a reliance on function props over value props passed down to wrapped components. However, the API changes are minor and listed below:
    • 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 2 - Removing a Validator error - Stack Overflow
I have multiple input fields I am validating, so I can't just set the form to valid if the validator is removed this...
Read more >
useForm - ClearErrors - React Hook Form
This function can manually clear errors in the form. Props. Type, Description, Example. undefined, Remove all errors. clearErrors().
Read more >
Form Validation in Under an Hour with Vuelidate - CSS-Tricks
Finally, we'll go through how to show form errors when the user has completed the form. Simplest case: showing the entry once you're...
Read more >
One in Group Required | JET Developer Cookbook - Oracle
Clear out the field and press Enter, and you will immediately see the error message. This is implemented with the form components oj-value-changed...
Read more >
form_set_error | form.inc | Drupal 7.x
Multistep forms not wanting to validate the whole form can set #limit_validation_errors on buttons to limit validation errors to only certain elements. For ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found