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

How to spawn 1 page if any checkbox is checked.

Explorer ,
Jun 24, 2019 Jun 24, 2019

Copy link to clipboard

Copied

Hello Community!,

Java Experience - Rookie

I have been trying to resolve this issue for a while now but cant get it to work.  The goal is to have 1 page(template) spawn based on 4 checkboxes.  If 1 or more of the checkboxes is checked then this page should be attached.  I have tried different things but run into issues such as it spawns every time any checkbox is checked leaving me with several attachments instead of just the 1.  I also need to be deleted when there are no checkboxes.  The spawned page is informational so it doesn't have to be edited in any way.

I tried using an export value to a hidden, locked text box and making the page spawn based on if that box was greater than 0 but it didnt turn out well.  Thank you for your assistance.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

387

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 ,
Jun 24, 2019 Jun 24, 2019

Copy link to clipboard

Copied

I would do it using the calculation script of a (hidden) text field, with the following logic:

- Count the number of checked check-boxes.

- If zero, and the number of pages in the file is not the original number (you'll need to maintain a variable with that value), delete the last page.

- If not zero, and the number of pages in the file is the same as the original number, spawn a new page from the Template.

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
Explorer ,
Jun 24, 2019 Jun 24, 2019

Copy link to clipboard

Copied

that sounds good but I dont know how to do that last else command.  The "If not zero, and the number of pages in the file is the same as the original number, spawn a new page".

Do you have an example I can try?

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 ,
Jun 24, 2019 Jun 24, 2019

Copy link to clipboard

Copied

LATEST

Something like this:

var originalNumPages = 4;

var count = 0;

// count checked boxes

if (count==0 && this.numPages>originalNumPages) {

    // delete last page

} else if (count>0 && this.numPages==originalNumPages) {

    // spawn new page

}

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