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

Need javascript

jsmith
Registered: Apr 18 2008
Posts: 9

Hello All,
Would someone please be so kind as to set me up with a javascript for a Acrobat Form text field that increases a number increment by one every time the form is accessed. I would be eternally grateful as this has consumed most of my day!

My Product Information:
Acrobat Pro 8.1.2, Windows
rivergh
Registered: Apr 16 2008
Posts: 7
I'm not a programmer and don't know the 'elegant' way to do it so I use a hidden field and add one to the value each time the document is opened. To do this, I simply put a couple lines in the 'on open' event of the document (replace 'myHiddenField' with your field name):

var a = this.getField("myHiddenField");
a.value = a.value + 1;

I'd be interested in a better solution too.
rivergh
Registered: Apr 16 2008
Posts: 7
... of course, you don't have to have the field hidden ... that's just my use.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
I do not think it is that simple.

What about users with Reader? Is the PDF on a network and being accessed by multiple users or will it be on a web site?

You will either have to use a global object and create a subscription or connect your form to a database for assigning the serial number.

For a lengthy discussion see:
http://forum.planetpdf.com/wb/default.asp?action=9&read=46297&fid=34#125330

George Kaiser

jsmith
Registered: Apr 18 2008
Posts: 9
gkaiseril wrote:
I do not think it is that simple.What about users with Reader? Is the PDF on a network and being accessed by multiple users or will it be on a web site?

You will either have to use a global object and create a subscription or connect your form to a database for assigning the serial number.

For a lengthy discussion see:
http://forum.planetpdf.com/wb/default.asp?action=9&read=46297&fid=34#125330
The PDF form will be used as an e-form template in our document management system. The number is the Customer Maintenance Agreement Number (CMA#).

Currently the form is accessed through a proprietary format that utilizes it's own database to generate the number through a simple excel formula. For my purposes I need to have a pdf form template in order for the e-form to capture the necessary data to index the document into the system. Since we are moving forward I only have a need to start at a specific number and add one every time a new CMA is created though the e-form. Because this is a new procedure I would like for it to be a seamless and changeless as possible. This is the only obstacle I have encountered since I have little to no Java experience. Is this more helpful?