Skip to main content
Participant
August 22, 2024
Answered

Javascript not working in Adobe Reader

  • August 22, 2024
  • 3 replies
  • 1244 views

I have created a form with checkboxes that when selected spawn a page at the end of the form and removes the page if unchecked. The script works great for me when I am using it in Acrobat Pro but when sent to the user, the script won't function in Adobe Reader. Here is a sample of the script I have for each check box:

if(event.target.value!="Off")
{this.getTemplate("Template Name" ).hidden=false;}
else
{this.getTemplate("Template Name" ).hidden=true;}

 

Is there anything I can change or re-work to get the pages to spawn and delete as needed for the user? I am a complete novice at this.

This topic has been closed for replies.
Correct answer Kim33992463y2yp

Thank you so much! I was able to amend this to what I needed and it worked perfectly.

3 replies

PDF Automation Station
Community Expert
Community Expert
August 22, 2024
Kim33992463y2ypAuthorCorrect answer
Participant
August 27, 2024

Thank you so much! I was able to amend this to what I needed and it worked perfectly.

Nesa Nurani
Community Expert
Community Expert
August 22, 2024

Use spawn method instead, something like this:

var t1 = this.getTemplate("Template Name");
if (event.target.value != "Off"){
t1.spawn({nPage: numPages, bRename: false, bOverlay: false});}

 

Also, you can't hide template, you need to delete page using this.deletePages(), keep track of where you spawn template and delete that page.

Bernd Alheit
Community Expert
Community Expert
August 22, 2024

Your script doesn't spawn or delete pages.

Acrobat Reader can't show or hide pages.