Skip to main content
Participant
January 7, 2025
Question

Prevent date change when opening form again

  • January 7, 2025
  • 1 reply
  • 144 views

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
January 7, 2025

Replace the last line with:

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