Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
1

Sequential Number Generator in a PDF

New Here ,
Sep 22, 2017 Sep 22, 2017

I have created a fill-able form in which i want to have the Work Order "WO" field generate a sequential number when I open the master form. When I save and close the form I want the number to remain the same and and generate a new number. I am using Adobe Acrobat Pro DC..

TOPICS
PDF forms
51.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jan 30, 2021 Jan 30, 2021

Select 'javascript' tool and then 'document javascript' or while in 'prepare form'tool press 'shift+d'
add new script and replace any code already in when you open window with this code:

var num = this.getField("Text1");
num.value = Number(num.value)+1;
num.defaultValue = num.value;

Change field name in code to the name of your field.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 22, 2017 Sep 22, 2017
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 29, 2021 Jan 29, 2021

The links are not working for me, I get 404 Not Found error.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 30, 2021 Jan 30, 2021

Select 'javascript' tool and then 'document javascript' or while in 'prepare form'tool press 'shift+d'
add new script and replace any code already in when you open window with this code:

var num = this.getField("Text1");
num.value = Number(num.value)+1;
num.defaultValue = num.value;

Change field name in code to the name of your field.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 30, 2021 Jan 30, 2021

It gives me an error message:  syntaxError: missing (before formal parameters 1: at line 2

Is there something I have to setup before adding this script to the pdf?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 30, 2021 Jan 30, 2021

Hetal0D45, please go to your PDF and copy/paste here the exact code you currently have.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 30, 2021 Jan 30, 2021

I don't have any right now.  Nothing has worked for me so far.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 30, 2021 Jan 30, 2021

Yes, but you had some when you got the error message. As a programmer, you need to give both the source code AND the error message, at the same time. Telling us "nothing works" doesn't help us to help you; you are the programmer.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 30, 2021 Jan 30, 2021

No I am not a programmer, but I tried the following script that is already in this thread from Nesa Nurani:

var num = this.getField("Text1");
num.value = Number(num.value)+1;
num.defaultValue = num.value;

I am just an Adobe user that is trying to create sequential forms in Adobe Acrobat Pro DC.  I have tried for months to get help from Adobe Help line, but after many hours and months of being transferred from one agent to another, finally decided to search the web to see if someone else has a solution to my issues.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 30, 2021 Jan 30, 2021
LATEST

I got it to work. Thank you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines