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

Show Template as Page 2 of 3

New Here ,
Oct 07, 2018 Oct 07, 2018

Copy link to clipboard

Copied

I'm trying to display a different page 2 based upon checkbox selection and I have the below function at the document level, which is called upon for each checkbox and it hides and shows the template beautifully. However, the template appears at the end of the document (page 3 of 3) and I would like for it to always display as page 2 forcing the previous page 2 to the new page 3. Can I accomplish this without spawning?

function NarrativeDisplay() {

   var narr1 = this.getField("1E-F1_NARRATIVE").value;

   var narr2 = this.getField("1E-F2_NARRATIVE").value;

   var narr3 = this.getField("1E-F3_NARRATIVE").value;


   if (narr1 == "Off" && narr2 == "Off" && narr3 == "Off") {

      this.getTemplate("Narrative").hidden=true;

  } else {

      this.getTemplate("Narrative").hidden=false;

  }

}

TOPICS
Acrobat SDK and JavaScript

Views

409

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 , Oct 07, 2018 Oct 07, 2018

You can use the movePage command after un-hiding the Template page to move it to the desired location.

PS. Why all the colors? it makes it quite difficult to read the code (to me, at least).

Votes

Translate

Translate
Community Expert ,
Oct 07, 2018 Oct 07, 2018

Copy link to clipboard

Copied

You can use the movePage command after un-hiding the Template page to move it to the desired location.

PS. Why all the colors? it makes it quite difficult to read the code (to me, at least).

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 ,
Oct 07, 2018 Oct 07, 2018

Copy link to clipboard

Copied

LATEST

Apologies, I pasted out of a dark themed code editor. That did the trick - thank you so much!

function NarrativeDisplay() {

   var narr1 = this.getField("1E-F1_NARRATIVE").value;

   var narr2 = this.getField("1E-F2_NARRATIVE").value;

   var narr3 = this.getField("1E-F3_NARRATIVE").value;


   if (narr1 == "Off" && narr2 == "Off" && narr3 == "Off") {

   this.getTemplate("Narrative").hidden=true;

  } else {

   this.getTemplate("Narrative").hidden=false;

   this.movePage(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