Copy link to clipboard
Copied
How do I add a date field in a footer that will display the date as the date the form was opened / printed?
Create a (read-only) text field, let's call it Today.
Then go to Tools - JavaScript - Document JavaScripts and create a new script (let's call it "load") with this code:
this.getField("Today").value = util.printd("mm/dd/yyyy", new Date());
Copy link to clipboard
Copied
Create a (read-only) text field, let's call it Today.
Then go to Tools - JavaScript - Document JavaScripts and create a new script (let's call it "load") with this code:
this.getField("Today").value = util.printd("mm/dd/yyyy", new Date());
Copy link to clipboard
Copied
First, when I go to tools in Adobe I don't get an option for Java Script. So I created the Text Field, went to properties, custom options, custom format script, and then entered the script below in the Format Field.
this.getField("Today").value=util.printd("mm/dd/yyyy", new Date());
I got the following error message and nothing is displayed or printed on the form.
util.printed is not a function
1:Field:Format
util.printed is not a function
1:Field:Format
InvalidSetError: Set not possible, invalid or unknown.
Field.value:1:Field Today:Format
Any suggestions?
Copy link to clipboard
Copied
I figured it out. I added the script in the Custom Calculation and it worked. Thanks for your help!
Copy link to clipboard
Copied
I spoke prematurely. While the date shows up when I click the field the date does not appear when I print it. Any suggestions?
Copy link to clipboard
Copied
I entered your script in the custom calculation script. The date shows up when I click on the field, but it does not appear on the document when I print it which is the important thing. Any suggestions?
Copy link to clipboard
Copied
Why did you place it in the custom calculation script? Read my initial message again and follow the instructions in it.
If you don't see JavaScript under Tools then you'll need to enable it. What's your version of Acrobat?
Copy link to clipboard
Copied
Under Edit Preferences I show that my Java Script is enabled, but it still does not show up under the Tools Menu. I am using Adobe Acrobat 9 Standard.
Copy link to clipboard
Copied
In that case you don't have (direct) access to the document-level scripts.
What you can do instead is put this code under the Page Open event of the first page of the file.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now