Auto numbering every time a fillable pdf form opens and saves a file with the new number each time
- August 13, 2023
- 返信数 2.
- 2270 ビュー
I am trying to generating automatic numbering for a file each time it opens starting from 000501 then getting it to save the form after completion on exit. I enterred the code below:
if (this.documentFileName == "TFMC Work Order Form.pdf")
if (global.count == null) //checks to see if count exists
{
global.count = 000501 //sets initial count, you can change to suite your needs
global.setPersistent("count",true) //makes the counter a global object so it is persistent data
}
else
global.count++ //increments the the counter by one when the document is opened
var f = this.getField("Order Number").value = Number(this.getField("Order Number").valueAsString)+1; //creates a variable for the form field where the counter will be displayed
f.value = global.count //sets the form field to equal the counter
but it doesn't generate the number even if I start the field area with 501, howver if I go into prepare form the number sometimes runs a counter in the field 4, or 5. Auto generating only when I go into prepare form not always, only sometimes.
Can you assist?
