I have a text input widget (called ID) on my form that’s disabled and binding to {{utils.getUniqueID()}}
The purpose of this widget is to serve as the primary key for the database row.
The getUniqueID function is defined in the utils JSObject as following:
I’ve got the Reset of Submit property set to True for this input widget.
When the form is submitted, all other widgets are resetting just fine, except this one.
The ID widget text does not change (new unique ID is not generated).
I have even forced the form widget to reset with children on submit success. But still doesn’t seem to work.
Apologies for the delay @innomalous. I tried it out and was facing a similar issue. and it was resolved by storing the random number in a store variable - Store Value - Appsmith
so in your random number generator function, do this
And in the Id input widget, in the Default Value bind this data
{{appsmith.store.randomId}}
And lastly, ensure you call the JSObject to generate the random number when you click on the Save button. So that every time when the form is reset a new number is generated in the Id input box.
@dancia Were you able to determine if this was by design or a bug?
I tried putting {{Math.floor(Date.now() * Math.random()).toString(32)}} in the Default text instead of calling the function and it still doesn’t seem to reset.