Copy link to clipboard
Copied
I have a check box button on page 1. The following code works to show/hide page 2 . Click the button, show page 2. Unclick the button, hide page 2.
However, it gives me a "bad parameter" despite working. Any ideas?
if(event.target.value!="Off")
{this.getTemplate("2" ).hidden=false;}
else
{this.getTemplate("2" ).hidden=true;}
Ok the target page isn't set. That is the source of the error. Page numbers in the Acrobat JavaScript model are zero based. Page #1 is 0, and Page #2 is 1;
Use this code:
if(event.target.value!="Off")
{this.getTemplate("2" ).spawn(1, false, false);}
else
{this.deletePages(1);}
Copy link to clipboard
Copied
I deleted the zoom action and I'm not seeing any errors. Could be there is a timing issue on your system. Or the problem was that the check box wasn't synchronized with the template.
One other improvement. There is no need to have 3 separate JS actions. The code should be combined into a single action.
Copy link to clipboard
Copied
Interesting. Well thanks for helping me work through this!
I will combine all the JS actions into one too.