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

PDF/JavaScript/Checkbox

Community Beginner ,
Oct 15, 2019 Oct 15, 2019

Hello,

 

I have a simple PDF that has several checkboxes on it. What I'm wanting to do is have a specific PDF open depending on what checkboxes get checked (users clicks on a "Submit" button when done selecting forms). So, let's say the checkbox for form 026 is checked (026Cb), and so is the checkbox for form 053 (053Cb), but nothing else, then open an already saved PDF packet that has just those two forms in it. I added code that just dislays a message for now and get it to work for one checkbox check, but keep getting errors when trying to add more checkboxes to it. This will basically be a big nested if/else type check. Here is what I have.

if (this.getField("026Cb").value != "Off")
{app.alert("026 Checked", 3);}
else {app.alert("026 not Checked", 3);}

2.9K
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Oct 15, 2019 Oct 15, 2019

You have multiple errors in your code.

1. The OR operator in JS is "||".

2. There's no such command as fopen in Acrobat JS.

3. Your file-path syntax is incorrect.

 

Try this:

app.openDoc("/S/shz_online_agreements/site_files/packets/066p_PAF.pdf");

View solution in original post

Translate
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
Community Expert ,
Oct 15, 2019 Oct 15, 2019

What errors are you getting? What code are you using?

Translate
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
Community Beginner ,
Oct 15, 2019 Oct 15, 2019
Hello, I now made it a bit farther. I can perform the check if all the checkboxes are checked. But having trouble writing the needed command, that if all the checkboxes are checked, then open a specific PDF file on my Shared drive. This is what I now have. Using the javascript editor in Adobe Acrobat Standard DC. if (this.getField("026Cb").value != "Off" | this.getField("053Cb").value != "Off" | this.getField("065Cb").value != "Off" | this.getField("068Cb").value != "Off" | this.getField("069Cb").value != "Off" | this.getField("071Cb").value != "Off" | this.getField("072Cb").value != "Off") {file = fopen("S:\shz_online_agreements\site_files\packets\066p_PAF.pdf", 3);}
Translate
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
Community Expert ,
Oct 15, 2019 Oct 15, 2019

You have multiple errors in your code.

1. The OR operator in JS is "||".

2. There's no such command as fopen in Acrobat JS.

3. Your file-path syntax is incorrect.

 

Try this:

app.openDoc("/S/shz_online_agreements/site_files/packets/066p_PAF.pdf");

Translate
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
Community Beginner ,
Oct 16, 2019 Oct 16, 2019
LATEST
That worked. Thanks for your help.
Translate
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