Form reset instead of clear

Would be nice to have a “form reset on submission” in addition to the “clear on submission” option currently available.

As an example, I have a form in a modal, where the default value for one of the fields is the number 0. I have it set so that the form is cleared after submission. However, once the form is cleared, the default value of the field above is not set to 0, but is instead blank.

11 Likes

I have the same need. I have some default values which I would like to be reset after the form has been submitted as opposed to cleared.

In my case some of those fields are always disabled as a way to give the user visibility into the values, but they shouldn't be allowed to change them.

+1 for this

Also needing this. Any updates from the Retool team? This almost makes the default values useless. Seems like it wouldn't be a huge effort to implement compared to the ROI (way better UX).

Hey! Thanks everyone for bringing this to our attention. We have submitted a report for this, and will update this post when we have any further updates!

Any news/update on this?

Hi @Irfan! No updates yet, but I bumped the bug report to let the team know that you checked in. Will update this thread accordingly :blush:

1 Like

Would like to see this exact same behavior for multiselect component. Return to default when cleared instead of empty.

Hi all,
Late to the party here, but a quick fix I've used is using a setData argument, where each of the form's data keys are set to null. To make it super easy

  1. create a transformer with the following general code
let x = {{FORMNAME.data}};
let k = _.keys(x);
for (i=0; i < k.length ; i++){
  x[k[i]]=null;
}
return x;
  1. Use an event-handler > control component > set data > transformer.value

I have a button with an X on it on every form that calls this kind of event handler, allowing reset to defaults.

1 Like

As some additional features of the new Form v2 component, we now have both form.clear() and a form.reset() functions! :tada:

The on submission behavior is also a bit more flexible now, defaulting to reseting if there is a default value, or clearing if there is no default value:

You can also use an event handler and a control component action to customize this further

2 Likes