These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Form Date and Calculation Issues

tzubak
Registered: Sep 3 2008
Posts: 8

I've had nothing but problems with this issue. I inserted a date field and got it to work until it is saved. When I open the PDF, it is blank. The same code works in another file fine.

Also, I have some fields that get calculated. I set the calculated order to get it to work, but when I save and open, the order gets reset. Its like these changes aren't getting saved. Am I doing something wrong?

My Product Information:
Acrobat Pro 8.1.2, Macintosh
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Regarding the first issue, what code are you using and where did you place it, exactly?

Regarding the second issue, I've seen some folks report something similar, but have not been able to nail down a cause. For some it seems to just start working correctly. It is probably not something you're doing wrong. I'd be interested in looking at a form that behaves this way.

George
tzubak
Registered: Sep 3 2008
Posts: 8
The code I am using for the date:

// get new Date object
var d = new Date();

// format to mm/dd/yyyy
var sDate = util.printd("mm/dd/yyyy", d);

// insert date into form field
this.getField("todaysDate").value = sDate;

This showed up fine once after I saved and reopened, after opening once more, it went blank.
tzubak
Registered: Sep 3 2008
Posts: 8
I might have figured this out. I had "Enable Usage Rights" activated. It seems this prevents those changes from saving. I will test more on this...
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
You need to tell us where you placed this code.

George
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Not all scripts fire once a PDF form is opened. There are specific events that cause a script to be run. Because you placed the script for the date field within the "Custom calculation script" area, that script will not run until an input field used in a calculation script is updated. If you want this script to run when the PDF is opened, you need to place the script in a document level script, see [url=http://www.acrobatusers.com/tutorials/2007/js_document_scripts/]Entering Document Scripts[/url] by Thom Parker.

If you are going to create Reader Enabled forms, keep a copy of the from prior to being Reader Eneabled. If you have not turned off the warning, there is a warning about this before enabling the rights and it means what it says.

George Kaiser