Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Today's Date in the Footer

Community Beginner ,
Feb 01, 2016 Feb 01, 2016

How do I add a date field in a footer that will display the date as the date the form was opened / printed?

TOPICS
Acrobat SDK and JavaScript
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 01, 2016 Feb 01, 2016

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());

Translate
Community Expert ,
Feb 01, 2016 Feb 01, 2016

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());

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 01, 2016 Feb 01, 2016

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 01, 2016 Feb 01, 2016

I figured it out.  I added the script in the Custom Calculation and it worked.  Thanks for your help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 01, 2016 Feb 01, 2016

I spoke prematurely.  While the date shows up when I click the field the date does not appear when I print it.  Any suggestions?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 01, 2016 Feb 01, 2016

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 01, 2016 Feb 01, 2016

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 01, 2016 Feb 01, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 01, 2016 Feb 01, 2016
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines