Skip to main content
June 24, 2019
Question

How to spawn 1 page if any checkbox is checked.

  • June 24, 2019
  • 1 reply
  • 765 views

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.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
June 24, 2019

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.

June 24, 2019

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?

try67
Community Expert
Community Expert
June 24, 2019

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

}