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

Sequential Number Generator in a PDF

New Here ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

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

Views

50.0K

Translate

Translate

Report

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

correct answers 1 Correct answer

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.

Votes

Translate

Translate
Adobe Employee ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

I got it to work. Thank you.

Votes

Translate

Translate

Report

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