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

Need to add condition to a checkbox that links to another page (PDF)

Explorer ,
Jun 21, 2023 Jun 21, 2023

I used the Acrobat generic function to link another page to a checkbox when clicked. However, if I need to uncheck that box, it will still take me to that page. Is there a way to code this so that if I deselect the checkbox, it stays put on that same page?

TOPICS
Create PDFs , How to , JavaScript , PDF , PDF forms , Standards and accessibility
617
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 ,
Jun 22, 2023 Jun 22, 2023
LATEST

 

if (event.target.value != "Off"){
this.pageNum = 0;
}

 

Just replace 0 with the page number you wish to link, keep in mind pages start from 0, so first page is 0, second is 1...etc if you wish to link to page 5 replace 0 with 4.

This will work if that page is in the same file (not another file).

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 ,
Jun 21, 2023 Jun 21, 2023

Yes, use script only if checkbox is checked.

if (event.target.value != "Off"){
//put your script here
}
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 ,
Jun 22, 2023 Jun 22, 2023

But linking to a specific page of another file using a script is very tricky, and requires embedding a script in the target file. I think they meant they used the built-in "Go to a page view" command, which can't be combined with a script. You either do it one way, or the other.

A better solution is not to use a check-box for this kind of thing, but a button.

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
Explorer ,
Jun 22, 2023 Jun 22, 2023

Thank you! I think my request is a little too complicated. I might as well not link to any other page and have the applicant go over to that page themselves.

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
Explorer ,
Jun 22, 2023 Jun 22, 2023

What if I didn't use a script to link the checkbox to another page? What should I put in the script part in that code?

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 ,
Jun 22, 2023 Jun 22, 2023
LATEST

 

if (event.target.value != "Off"){
this.pageNum = 0;
}

 

Just replace 0 with the page number you wish to link, keep in mind pages start from 0, so first page is 0, second is 1...etc if you wish to link to page 5 replace 0 with 4.

This will work if that page is in the same file (not another file).

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