Solved

Today's Date Default Field in Acrobat X

Posted on 2011-03-03
2
2,986 Views
Last Modified: 2012-05-11
Hi there.
Several years ago, I created a PDF document that had a date field that defaulted to today's date when it was opened. It used some JavaScript to make that happen. I've since upgraded to Adobe Acrobat X and need to do this for another form, but can't remember how I did it. I've tried several online resources and have come up empty. It seems everything I've found is for a different version of Acrobat and doesn't apply. Here's what I've tried so far:

http://www.ehow.com/how_2316630_insert-date-field-adobe-acrobat.html
The problem I'm running into is that the Trigger event listed in this article isn't consistent with what's available in this version of Acrobat. I was looking for a "Page Open" event to tie the JavaScript code to, but I only have these options:

Mouse Up, Mouse Down, Mouse Enter, Mouse Exit, On Focus, On Blur

Right now, the Java script code is applied in the Actions tab of the Text Field Properties, but I can't get this to work. Any suggestions? Am I missing something? Here's the code used to generate today's date:

var f = this.getField("wells_datefield");
if (!f.value) f.value = util.printd ("m/d/yyyy", new Date());

Thanks for your help.

J
0
Comment
Question by:brownmetals
2 Comments
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 500 total points
ID: 35036877
You can use a calulated value for that field. Bring up the field properties and select the "Calculate" tab, then select to use a custom calculation script and use the following line:

event.value = util.printd("m/d/yyyy", new Date());

That should do the trick.
0
 
LVL 4

Author Closing Comment

by:brownmetals
ID: 35060084
Awesome. Thanks for your help.
J
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Acrobat’s JavaScript is a great tool to extend the application, or to automate recurring tasks. There are several ways a JavaScript can be added to the application or a document (e.g. folder level scripts, validation scripts, event handling scripts,…
PDF files have been in the limelight due to its unmatched features.  Personal documents, emails, business reports and eBooks are all converted into PDF files owing to peerless features provided by it. Adding watermark to a PDF file is a method to se…
In this third video of the Xpdf series, we discuss and demonstrate the PDFtoText utility, which converts PDF files into plain text files. Download and install the software.: You may have already downloaded and installed the Xpdf tools while watching…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question