Skip to main content
Inspiring
May 23, 2023
Answered

Auto-populated form date

  • May 23, 2023
  • 1 reply
  • 5277 views

Hi. I have created a form where the "form date" auto-populates to the day it was opened (using this Javascript:  this.getField("WED").value = new Date;). We would like that date to remain constant throughout the multiple openings and editings, but it seems to give the current date whenever opened. Is this possible?

 

Thanks

This topic has been closed for replies.
Correct answer Mike3002351437af

This won't work in Reader. The original code you posted should work fine.


Update to the debacle:

In Acrobat Standard 2020, you must:

click Page Thumbnails

r click Page Properties

enter script on Actions tab

 

That made it work...only then did we realize that the date would be stuck on the date of the fix lolololol. Thanks for everyone's help through this.

1 reply

Nesa Nurani
Community Expert
Community Expert
May 23, 2023

Add date only if field is empty.

if(this.getField("WED").valueAsString == "")
this.getField("WED").value = new Date;

Inspiring
May 24, 2023

Thanks Nesa! I will plug this in and let you know tomorrow.

Inspiring
May 25, 2023

Hi Nesa, that is not working. When opening the document, you can see the prior date for a split second before it changes to the current date. Maybe I did not enter the calculation script correctley?