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

View counter in a PDF Form

MolefaceNZ
Registered: Jul 10 2008
Posts: 7

I want to add a counter to my form created in acrobat pro 8 so that every time the form is opened the counter increases by 1. I've tried using a global object counter but I can't get it to work in 8.0.

My Product Information:
Acrobat Pro 8.0, Macintosh
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The problem with the global object is that it's no longer global because of new security restrictions in Acrobat 8. You can overide this restriction from the JavaScript Preferences panel. But this will only work for your machine.

However, as long as the file is saved in the same location, and the globals file is not overloaded, a global variable created by a particular document should be accessible from that document, but no others.

Did you make the variable persistant. Here's some example code that should be placed in a document level script.

if(typeof(global.myCount) == "undefined")
{
global.myCount = 0;
global.setPersistent("myCount",true);
}
else
global.myCount++;

this.getField("Text1").value = global.myCount

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script