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

Generating Sequential Number

Explorer ,
Jan 25, 2023 Jan 25, 2023

Copy link to clipboard

Copied

Hi, I have created a button to spawn new pages based on the template page in a PDF form. and in the template page, there is a field to generate sequential number everytime I spawn a new page, the trouble is every time I saved it and reopen it, the number goes up by "1", which messed up the whole document, so how am I able to set a condition to it to stop it updating every time I save it and reopen it. Does anyone have a clue to it please? Thanks very much.

 

The scripts I used for both spawning page and sequential numbering are here:

this.getTemplate("Task Card").
spawn(this.pageNum+1,true,false);

 

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

TOPICS
Acrobat SDK and JavaScript

Views

365

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 26, 2023 Jan 26, 2023

Instead of doing it like that you should use the page property of each field, like this:

event.value = (event.target.page+1);

Then run the calcuateNow command after spawning the pages, and it should be fine.

Votes

Translate

Translate
Community Expert ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

LATEST

Instead of doing it like that you should use the page property of each field, like this:

event.value = (event.target.page+1);

Then run the calcuateNow command after spawning the pages, and it should be fine.

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