Skip to main content
Known Participant
November 28, 2024
Question

Automatically fill date field when a check-box is ticked

  • November 28, 2024
  • 1 reply
  • 6522 views

I have created a form which will be filled in over several days. When a checkbox is ticked, I want the date field next to it to automatically fill in with today's date. I don't want this entry to update when the date changes; it needs to record when that particular box was ticked.

Please could you help me write a script to help this occur? I have to then cover about 40 pages with the same fields, so would like to get it right before I go on a copying session! Thanks very much.

This topic has been closed for replies.

1 reply

PDF Automation Station
Community Expert
November 29, 2024

Enter the following mouse up action script in the check box (assuming the text field name is Date):

if(!this.getField("Date").value && event.target.value!="Off")

{this.getField("Date").value = util.printd("mm/dd/yyyy", new Date());}

The blue text ensures the date will not update after it has already been entered.  If you want it to update every time the box is checked, remove the blue text from the script.

Nesa Nurani
Community Expert
November 29, 2024

How can it update all the time if it's triggered by Mouse UP action?

You are missing 'd' in util.printd.

PDF Automation Station
Community Expert
November 29, 2024

By "all the time" I meant if the box is checked again.