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

Show/hide pages based on check boxes

Community Beginner ,
May 25, 2023 May 25, 2023

I would like to create a fillable form that will show pages if certain checkboxes are selected. Initially, the pages would be hidden but checking boxes would reveal them. Is this possible in Adobe Acrobat Pro?

TOPICS
Create PDFs , Edit and convert PDFs , How to , JavaScript , PDF , PDF forms
4.4K
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
2 ACCEPTED SOLUTIONS
Community Expert ,
May 25, 2023 May 25, 2023

Yes, by turning pages into a template, you can spawn them when needed and delete pages instead of 'hiding' them.

There are a lot of posts on this forum with examples, here is an example how to make template and sample script to spawn them: https://community.adobe.com/t5/acrobat-discussions/indesign-drop-down-menu-choice-changes-hides-page... 

And here is example file that spawn/delete pages: https://drive.google.com/file/d/1mFJfwXYzwr3WXM8sjN4XS8tz4J9k2pPA/view?usp=share_link 

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 ,
May 26, 2023 May 26, 2023

It should work in reader but not if it's on mobile device. 

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 ,
May 25, 2023 May 25, 2023

Yes, by turning pages into a template, you can spawn them when needed and delete pages instead of 'hiding' them.

There are a lot of posts on this forum with examples, here is an example how to make template and sample script to spawn them: https://community.adobe.com/t5/acrobat-discussions/indesign-drop-down-menu-choice-changes-hides-page... 

And here is example file that spawn/delete pages: https://drive.google.com/file/d/1mFJfwXYzwr3WXM8sjN4XS8tz4J9k2pPA/view?usp=share_link 

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 ,
May 26, 2023 May 26, 2023

I just attempted to use the document in Adobe Reader and it does not function. Do you know if there is there a way to maintain the template-page-spawning functionality within Reader? Solving this problem for my business will only make sense if the resulting document can be used on-site. 

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 ,
May 26, 2023 May 26, 2023

It should work in reader but not if it's on mobile device. 

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 ,
May 26, 2023 May 26, 2023

Ahh right ok thank you. 

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
Participant ,
Jun 02, 2023 Jun 02, 2023

Hello Nesa,

(Apologies if i have  not posted correctly)

 

Im looking at using the code you have provided here, but im getting stuck a little.
I have a 2 page document, but I only wish the second page to show if the the drop down for additional notes is set to yes.  If set to no (default) id like the page to remain hidden.
Second page is named page2 and the drop down selcion is No (export n) or Yes (export y)


I have added this to the validation script

if(event.value == "y")
this.getTemplate("page2").spawn(this.numPages, false, false);

but cannot get the page to show  even if selected Yes

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

Change "y" to "Yes", or move script to calculate.

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
Participant ,
Jun 02, 2023 Jun 02, 2023

Thank you that worked, but is there a way to hide it again if No is selected ?
Selecting No, does not hide the page, and selecting Yes again, adds another copy
I have looked at your template test file but that just swaps pages around and doesnt actually remove the page if no additonal pages are required

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

I have played with your code from the test tempate and have managed to get it to work using the following.

 

var p2 = this.getTemplate("Page2");


var p = Number(this.numPages)-1;
if(this.numPages != 1)
this.deletePages(1,p);

if (event.value == "Yes")
p2.spawn(numPages, false,false);

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 ,
May 26, 2023 May 26, 2023

Amazing! Thank you so much! That looks pretty straightforward.

 

Would you be able to help me out with the validation script for a Checkbox? Also for Radio Buttons? 

 

I am creating a building inspection form to collect relevant material spec information and would like to have the option of spawning the next room if needed (checkbox) and additional room sections (radio buttons) if needed. 

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