Copy link to clipboard
Copied
I have 3 checkboxes named (NYC, NY and NJ) that spawn a template (all 3 are different templates) when checked and hides it when unchecked, but I need it to show a specific page not at the end, what am I missing? (im not a coder)
if(event.target.value!="Off")
{this.getTemplate("NYC" ).hidden=false;}
else
{this.getTemplate("NYC" ).hidden=true;}
The code I provided needs to be put into the original code that uses the check state to determine whether the template is spawned or deleted.
if(event.target.value!="Off")
{this.getTemplate("NYC" ).spawn(nTargetPageNumber, false, false);}
else
{this.deletePages(nTargetPageNumber);}
The trick for removing the page is to determine the actual page number. This is simple if nothing has changed since the template was spawned, but if other templates were spawned, then you'll need some way to find t
...Copy link to clipboard
Copied
You can spawn template pages where you want.
Copy link to clipboard
Copied
I can move it yes manually, but when i click on the checkbox it re spawns at the end of the form
Copy link to clipboard
Copied
The code you've shown does not "spawn" the page template. It hides and shows the actual template, which will always be placed at the end of the document. This will not work in the free Reader. To make the page appear at the desired location it has to be "spawned".
this.getTemplate("NYC" ).spawn(nTargetPageNumber, false, false);
Copy link to clipboard
Copied
Thank for you this very helpful. Now if I uncheck the box it "spawns" again is that supposed to be?
Copy link to clipboard
Copied
The code I provided needs to be put into the original code that uses the check state to determine whether the template is spawned or deleted.
if(event.target.value!="Off")
{this.getTemplate("NYC" ).spawn(nTargetPageNumber, false, false);}
else
{this.deletePages(nTargetPageNumber);}
The trick for removing the page is to determine the actual page number. This is simple if nothing has changed since the template was spawned, but if other templates were spawned, then you'll need some way to find the page. The best technique is to have a field with a unique name on the page.
Copy link to clipboard
Copied
Thank you very much Thom, it worked perfectly.