Text Input not resetting on Form submit

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:

getUniqueID: () => {
return Math.floor(Date.now() * Math.random()).toString(32);
}

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.

What am I missing?

@innomalous Would it be possible for you to share a screen recording so that we can help debug the issue? Thanks

Hi @dancia , just shared the screen recording with you on PM.

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

storeValue('randomId',Math.floor(Date.now() * Math.random()).toString(32));

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.

Got it working using the Store method. Thanks! :+1: