NewOldMax / react-form-validator-core

Core validator component for react forms
MIT License
94 stars 44 forks source link

Is there a way to reset the form content + all validations at once? #63

Closed phillipemoreira closed 4 years ago

phillipemoreira commented 5 years ago

Is there a way to programmatically reset the whole form and keep isValid true?

My scenario is the following:

What happens Once I clear the values, <ValidatorComponent /> 's didUpdate understands prev and next props are different and starts the debounced validation cycle which results in isValid = false.

What I wanted A way to clear the values + reset all validations, like a start again feature.

What I have tried I have tried to use resetValidations(), but it runs before didUpdate lifecycle, therefore I end up with isValid = false anyways.

The only way I managed this to work was by placing resetValidations() inside a timeout :disappointed:

Things I would/wouldn't want to do:

NewOldMax commented 5 years ago

Please create some example on https://codesandbox.io/s/ so it will be better to analyze it

NewOldMax commented 4 years ago

closed due no activity