I had auto fill a form field with today's date working well in Acrobat 10, but having trouble getting it working in Acrobat DC.
I have a form with 3 date fields named Date_1, Date_2, and Date_3. I would like to set all 3 to Todays Date if the form is opened and these fields are empty.
Here is the code I created:
//-------------------------------------------------------------
//-----------------Do not edit the XML tags--------------------
//-------------------------------------------------------------
//<Document-Level>
//<ACRO_source>Enter Todays Date If Blank</ACRO_source>
//<ACRO_script>
/*********** belongs to: Document-Level:Enter Todays Date If Blank ***********/
function EnterTodaysDateIfBlank()
{
var f = this.getField("DATE_1");
if (!f.value) f.value = util.printd ("m/d/yyyy", new Date());
var f = this.getField("DATE_2");
if (!f.value) f.value = util.printd ("m/d/yyyy", new Date());
var f = this.getField("DATE_3");
if (!f.value) f.value = util.printd ("m/d/yyyy", new Date());
}
//</ACRO_script>
//</Document-Level>
_________________________________________________________________________
I see no JavaScript error message for the above. I am not sure how to "trigger" execution of this function upon form opening.
There is ample documentation for this on earlier versions of Acrobat on the web, but very little posted on Acrobat DC.