Skip to main content
Participant
September 23, 2024
Question

Creating a button that hides/reveals dropdown lists

  • September 23, 2024
  • 1 reply
  • 295 views

I am trying to create a form that includes multiple dropdown lists that are coded to populate a text box with the information. I have already successfully implemented code to autopopulate text boxes based on the dropdowns. I do not want the dropdown lists to appear visible in the final version of the document.

 

Is there a way to add a button or checkbox that will hide these dropdown lists? I understand this is going to include some javascript in order to function (if possible), if so would anyone be able to point me in the right direction?

 

I am very new to javascript and have been teaching myself throught this project so any feedback, tips, examples you may have will be greatly appreciated.

This topic has been closed for replies.

1 reply

PDF Automation Station
Community Expert
Community Expert
September 24, 2024

You can do it with a mouse up action script in either a button or a check box.  Do you want the trigger to toggle the visibility or just turn it off?  Here's the button script (assuming the dropdowns are called Dropdown1, Dropdown2, and Dropdown3):

this.getField("Dropdown1").display=display.hidden;

this.getField("Dropdown2").display=display.hidden;

this.getField("Dropdown3").display=display.hidden;

 

If all your fields have the same root name with period and suffix (example:  Dropdown.1, Dropdown.2, and Dropdown.3) you would only need one line of code:

 

this.getField("Dropdown").display=display.hidden;