tcomb-form icon indicating copy to clipboard operation
tcomb-form copied to clipboard

Way to reset the form to pristine ?

Open jwaggener opened this issue 9 years ago • 1 comments

Version

Tell us which versions you are using:

tcomb-form v0.7.5 react v^0.14.2

I would like to reset the form back to pristine condition. This is because when I just reset values, there is the possibilty of an error displaying. For example, a text input might have the initial value of null or an empty string. A user enters text. An error displays. The user hits 'cancel' or whatever. The form is set with the original values, however, the error 'You must enter at least one char' is an error we have. So then I am unable to set to a pristine condition.

Tell us what should happen

So then I am unable to set to a pristine condition. So that no errors are shown.

Tell us what happens instead

See above ^

My solution has been to change the key on the form. Changing this prop resets to pristine condition (no errors). However a colleague feels that in react, the key should only be used for items in a list.

Thanks in Advance.

jwaggener avatar Nov 15 '16 16:11 jwaggener

Same problem here. resetting back to defaultvalues or null still triggers validation and errors are shown.

sesteva avatar Aug 17 '17 04:08 sesteva