Skip to main content
allenl69705437
Participant
September 29, 2023
Question

Creating Button to activate other buttons

  • September 29, 2023
  • 1 reply
  • 1380 views

Hello everyone, long time reader of these forums. This is my first post. Thank you to everyone that has posted questions, and these who have helped out so much. 

 

I am currently working on an interactive 3D PDF. This allows users to turn on and off various components in the CAD model. I currently have buttons that turn off a whole series of parts, my goal is create an additional button that will activate all of the buttons at once. I posted a reference picture of how my buttons are layed out. Any help will be appreciated.

 

Thank you

Allen 

 

 

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
September 29, 2023

How you do this depends on what you mean by "Active". 

 

There are two ways to make a form field inactive.

1. Hide the button:

https://www.pdfscripting.com/public/Hiding-and-Showing-Form-Fields.cfm

 

2. Set the button to readOnly. This method can be confusing to users because there is no automatic visual indication that the button is inactive, such as graying it out.  But here's an article that explains how to create this effect:

https://acrobatusers.com/tutorials/js_disabling_fields/

 

Or by "Activate", do you mean running the code already in the buttons from another button?  There isn't a built-in method for doing this in the Acrobat scripting model. But something you could do is make the code performed by the other buttons a set of document level funtions. The "Activate All" button would then just call theses functions. 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
allenl69705437
Participant
September 29, 2023

Hi Thom,

 

Thank you so much for your quick response. I think option 3 would be what I am looking for. I am sorry my javascript knowledge is very limited. I will look into setting a document level function. Any additional tips would be appreciated. Thanks once again. 

Allen 

Thom Parker
Community Expert
Community Expert
September 29, 2023

Here's an old article:

https://www.pdfscripting.com/public/Document-Level-Scripts.cfm

Nothing has changed except the Acrobat UI for getting the entry dialog. 

You'll need to use the Acrobat tool search to find where the JavaScript tools are now.

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often