These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

show/hide action based on combo box choice

gustojunk
Registered: Dec 9 2010
Posts: 2

Hi All,
I have to create a form for my kid's school, I have almost all working right except one thing:
 
I have combo box 1 with these options:
fruit
vegetables
meats
snacks
 
If the user chooses fruit, then I want to show combo box 2A:
oranges
pears
bananas
 
If the user chooses vegetables, then I want to show combo box 2B:
Lettuce
Spinach
coliflower
 
I have no idea about scripting or anything like that, I've only been using the default actions in Acrobat Pro 9. Any help would be greatly appreciated.
   

My Product Information:
Acrobat Pro 9.4, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
You might want to consider dynamically populating the second combo box instead of using two and showing/hiding them. For more information, see: http://acrobatusers.com/tutorials/2007/js_list_combo_livecycle
maxwyss
Online
Registered: Jul 25 2006
Posts: 255
Another approach would be using a popup instead of drop downs (aka combo boxes).

Have a look at the popUpMenuEx method in the Acrobat JavaScript doumentation. This would allow for hierarchical menus, and may be easier to program and to maintain.

smit462
Registered: May 20 2006
Posts: 20
You can make this happen with a fairly simple script.

In your first combobox, with the name "1," make sure you have specific export values for each selection:

give " " or "select food" an export value of "0"
give "fruit" an export value of "1"
give "vegetables an export value of "2"
give "meats" an export value of "3"
give "snacks an export value of "4"

Make sure you select "Commit selected value immediately."

Create your other 2 comboboxes "2A" and "2B."

Under the "Calculate" tab of your combobox "1," enter enter the following "Custom calculation script:"

var food = this.getField("1").value;
if (food == 1){this.getField("2A").display = display.visible;}
else {this.getField("2A").display = display.hidden;}
if (food == 2){this.getField("2B").display = display.visible;}
else {this.getField("2B").display = display.hidden;}


STEVE MITTEL
Senior Forms Designer
Texas Comptroller of Public Accounts

gustojunk
Registered: Dec 9 2010
Posts: 2
Thanks you all for the help. For this first pass I'm going to go with Steve's suggestion, I just tried it and it does what we need. great!

Also I had never used LifeCycle designer, I just launched it today ( I had no idea Acrobat eve had that installed on my computer) and played with it a bit, it's really cool too! but that might be for the next assignment, it seems like a lot more involved.