How to reset the form?
I am trying to reset the form after the form is submitted.
After the form is submitted the submit button gets disabled. How to reset the form and enable the submit button again for other submissions?
maybe something like below:
onSubmit={value => {
var promise1 = new Promise(function(resolve, reject) {
setTimeout(function() {
resolve("foo");
}, 300);
});
promise1.then(function(value) {
// resetForm and enable submit
alert(value);
// expected output: "foo"
});
}}
Typically we navigate to a different page or reinstantiate the form object. This should clear the submission settings. In the onsubmit you can change the submission object of the form to an empty object and that should also do it.
I have the same issue. I need other submissions because I have BE validation errors. After the user fix invalid input values, we need to send the submission again I had already tried
- Update form submission
- Update form JSON by copying them
- Resetting form by using 'resetForm' event, after submission (and my requests) done Only one thing that helps me - reset the form after ~500ms. But it is a very bad solution
Is there any other way to set the form to its original "not submitted" state? Or make a form that always has "not submitted"" state
I am closing the issue as it was created too long ago and there are no new comments here. I hope it was resolved. If not, please reopen it. Thanks!