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

Inserting a hidden template into a document after a specified page

New Here ,
Jan 17, 2023 Jan 17, 2023

Copy link to clipboard

Copied

I have made a form that has checkboxes that populate / unhide hidden templates within the document. The templates appear at the end of the doucment but I would like them to be inserted right after the page with the checkbox. I have made the checkbox so that if the user has checked the wrong box in error that he/she can uncheck it and it will rehide itself.  This is what I have so far. Are you able to help me out with the next step of having the page insert in the middle of the document and not the end?  I'm feeling stumped.

 

function checkCheckbox(){
if (this.getField("1-3").isBoxChecked(0) == true) {
this.getTemplate("Authorities1-3").hidden=false;
} else {
this.getTemplate("Authorities1-3").hidden=true;
}
}
checkCheckbox();

 

TOPICS
How to , PDF forms

Views

600

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

Copy link to clipboard

Copied

When you unhide a Template page it will always appear as the last page of the file. You can then use the movePage command to move it elsewhere, if you wish.

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

Copy link to clipboard

Copied

PS. I hope you're aware this won't work in Reader... You can't unhide (or hide) Templates there.

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
New Here ,
Jan 17, 2023 Jan 17, 2023

Copy link to clipboard

Copied

No, I wasn't aware. Is there a way to make the inserting of a hiddent template work in reader for the unlisenced user?

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

Copy link to clipboard

Copied

You need to spawn pages from it, instead of unhiding it. One of the parameters of the spawn method allows you to specify where to spawn it to.

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
New Here ,
Jan 17, 2023 Jan 17, 2023

Copy link to clipboard

Copied

I have this, but I would like to make the page "go away" if the client unclicks the box.  Is there a way to do this?

 

{
if(event.target.value == "Yes")

this.getTemplate("Beni1-10").spawn(event.target.page+1, true, false);this.getTemplate("Beni1-10").spawn(event.target.page+1, true, false);
this.pageNum = event.target.page+1;

}

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

Copy link to clipboard

Copied

Yes, you can use the deletePages command to remove the page, and if it's a spawned page it will also work in Reader (but not on other pages).

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

Copy link to clipboard

Copied

You can use this:

if(event.target.value == "Yes"){
this.getTemplate("Beni1-10").spawn(event.target.page+1, true, false);
this.pageNum = event.target.page+1;}
else
this.deletePages(event.target.page+1);

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
New Here ,
Jan 17, 2023 Jan 17, 2023

Copy link to clipboard

Copied

Thank you SOOOO much!  

 

Is there a way to make it delete two spawned pages instead of just the one?  Would the coding be,

 

this.deletePages(event.target.page+1);this.deletePages(event.target.page+2);

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

Copy link to clipboard

Copied

Use like this:

this.deletePages(event.target.page+1,event.target.page+2)

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
New Here ,
Jan 17, 2023 Jan 17, 2023

Copy link to clipboard

Copied

By the way...I so appreciate your help! I have been stuck on this for a bit.

 

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
New Here ,
Jan 17, 2023 Jan 17, 2023

Copy link to clipboard

Copied

OH MY GOODNESS!  Thank you so much! It worked!

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
New Here ,
Jan 17, 2023 Jan 17, 2023

Copy link to clipboard

Copied

If I have inserted 4 templates, can I use this coding for deleting the 4 pages?

 

this.deletePages(event.target.page+1,event.target.page+2,event.target.page+3,event.target.page+4);

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
New Here ,
Jan 17, 2023 Jan 17, 2023

Copy link to clipboard

Copied

I've tried it and it only deletes two of the four pages.

 

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

Copy link to clipboard

Copied

It is a range, so use like this (event.target.page+1,event.target.page+4)

it will delete pages between that range.

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
New Here ,
Jan 18, 2023 Jan 18, 2023

Copy link to clipboard

Copied

LATEST

Thank you so much!

 

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