Skip to main content
N8-K
Participating Frequently
October 7, 2018
Answered

Show Template as Page 2 of 3

  • October 7, 2018
  • 1 reply
  • 730 views

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;

  }

}

This topic has been closed for replies.
Correct answer try67

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).

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
October 7, 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).

N8-K
N8-KAuthor
Participating Frequently
October 7, 2018

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);

  }

}