Skip to main content
Participant
June 12, 2023
Question

Adobe Acrobat 23.001.20174 : How do I add a sequential number generator into a text field?

  • June 12, 2023
  • 1 reply
  • 759 views

I use Adobe Acrobat 23.001.20174 :

I have a pdf and want it to generate sequential numbers into a text file every time I create a new pdf. I want to open my form (for the first time) and have the NCMD NO. Field show 5652. After I fill out the form and save it as a new document, I want that new document to have the number 5652 in the NCMD No. Field, and the next time I open the "master form" I would like the NCMD No. field to show 5653.  

I tried using other resources and posts, but they were all from earlier versions and did not work. So far, I have tried navigating to Document Javascripts and inputting a code I found on the forum. But it does not do anything when I try to open "the master form," can someone explain to me how I can do this??

 

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
June 12, 2023

You can make it dependent on the file-name, so when you save it under a different name it won't update.

Something like this should work (under Tools - JavaScript - Document JavaScripts, but NOT in a function!):

 

if (this.documentFileName=="MasterDoc.pdf") this.getField("NCMD NO").value = Number(this.getField("NCMD NO").value)+1;

 

Adjust the file-name in the code to match the actual name, of course.