Copy link to clipboard
Copied
hi, please, i need the following, i actually have already seen the same request as mine and its answer somewhere on Adobe Support Community, but that channel is now closed, the answer, it provided is not clear on how i can add new JavaScript on Document JavaScript, given that the add button is not active on the "Document JavaScripts".
Here is the question:
I need to add a tracking number to a PDF form. I would like the numbers for each form to be sequential. As an example, I would like to open my form (for the first time) and have the tracking number field show 0001. After I completely fill out the form and save it as a new document, I want that new document to have the number 0001 in the tracking number field, and the next time I open the "master form" I would like the tracking number field to show 0002. Is this possible? If so, how do I do this?
This response i saw on it, by "Gilad D (try67)":
You can embed this code in the document (via Tools - JavaScript - Document JavaScripts) to achieve that:
var f = this.getField("Tracking Number"); if (f.value=="") f.value = "0001"; else f.value = util.printf("%04d", (Number(f.value)+1));
Please i will appreciate any support on this, thank you.
Copy link to clipboard
Copied
Enter a script name.
Press Add...
Delete the function definition.
Add your script.
Copy link to clipboard
Copied
You can use any unused name, e.g. init
Copy link to clipboard
Copied
Enter a script name.
Press Add...
Delete the function definition.
Add your script.
Copy link to clipboard
Copied
Ok, thank you very much, can i add anything as a script name? or am i supposed to add a particular script name?
Copy link to clipboard
Copied
Hi Bernd, Please is there a particular name i need to input as a script name to be able to add the script?
Copy link to clipboard
Copied
You can use any unused name, e.g. init
Copy link to clipboard
Copied
Ok, Bernd, thank you very much, it worked perfectly.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now