How do i get a form to populate the date automatically?

We converted our company contracts to fillable forms and I'm not sure how to format it so the the date automatically fills in the date field when you open a new form.


Paula Schell


2 Answers

Voted Best Answer

In Acrobat:
The script you create to display the current date when the document is opened is a document level script.
To create an automatic date field:1. Select Tools > Forms >. Edit > Add New Field > Text Field and create a text field. (For more infor-mation, see the section on Creating Form Fields in the Acrobat online help.) Select All Properties > General tab and name the field Today.
2. Select the Format tab, chooses Date for the format category, and chooses a month, day, and year format option (for example, “mmm d, yyyy”). On the General tab, make sure the field is read-only because it will be a calculated field, and click Close.
3. To create a document level script that is executed each time the document is opened, choose View > Tools > Document Processing > JavaScript > Document JavaScripts. Name the script Today, and click Add.
4. Delete the automatically generated text, defining a Today function, that is displayed in the script window. Type in the following text in the exact format (line wraps are OK) and click OK.
var f = this.getField("Today");f.value = util.printd("mm/dd/yyyy", new Date());

This script binds the Today field to the variable f, and then calculates the value. The newDate() ex-pression creates a new date object initialized to the current date and time. The util object is used to format the date into the month/day/year format.
5. Click OK in the JavaScript Edit dialog box, and then click Close in the JavaScript Functions dialog box.


By Eugene Williams   

This tutorial explains how to How to add date stamps to PDF forms.


Lori Kassuba   


Please specify a reason: