Skip to main content
Participant
Jan 7, 2025 7:56 AM UTC
Question

Prevent date change when opening form again

When i open my form it resets to current date. 

I want people to be able to choose current date or manual date or fix the date after saving. 

I have the following code, but that doesn't seem to work as planned. When not choosing the checkbox the textfield will be empty. 

if(this.getField("chkDateSign").valueAsString != "Off")
this.getField("Dato2_af_date").value = util.printd("dd.mm.yyyy", new Date());

else
event.value = "";

1 reply

try67
Community Expert
Community Expert
Jan 7, 2025 9:33 AM UTC

Replace the last line with:

this.getField("Dato2_af_date").value = "";
Translate