Skip to main content
warm_Lullaby5CA0
Known Participant
September 8, 2017
Answered

display page template after checkbox is ticked

  • September 8, 2017
  • 1 reply
  • 1282 views

Hoping someone can assist me, I am developing a acrobat form and am struggling a little bit! Basically I want the user to tick a checkbox and then click a button. If the checkbox is ticked when the button is pushed then the form should add a page template. At the moment I have the below code for this part however when I preview the form, it doesn't matter whether if the checkbox is selected or not selected, it spawns the page template anyways. This makes me think that there is something not right about my if statement. Can someone explain what I am doing wrong here?

*Advice is the name of the checkbox item.

var advice = this.getField("Advice");

if (advice = "true")

{

var advicePage = this.getTemplate("advice");

advicePage.spawn(this.numPages, true, false);

}

This topic has been closed for replies.
Correct answer Bernd Alheit

Shared Files - Acrobat.com


You must use the value of the check box:

var advice = this.getField("Advice").value;

1 reply

Bernd Alheit
Community Expert
Community Expert
September 8, 2017

Use:

if (advice == "true")

not:

if (advice = "true")

warm_Lullaby5CA0
Known Participant
September 8, 2017

Now it does not spawn the page at all (whether the checkbox is ticked or not).

Bernd Alheit
Community Expert
Community Expert
September 8, 2017

What is the export value of the checkbox?