I've been tasked with creating a fillable form my workplace, and unfortunately, LiveCycle (honestly, coding / scripting in general) is not my strong suit.
This forum has been a huge asset already, with previous suggestions being of great help. However, I think I've gotten as far as I can without asking for some assistance.
My form already has drop down menus that are populated dependent upon selections made from a prior drop down menu. I'm trying to find the option to attach a file to use as an example, but until I do (or until I edit in a link) I'll try a quick description. The form is regarding Alarm System information, and the current fields I have pertain to Manufacturers and Models of alarm systems. A quick comparison would be cars. Selecting "Honda" in the first drop down would populate the second drop down with "Accord, Element, etc." as individual options.
What I've been tasked with adding now is Emergency Authority information for each area. This means that the first drop down would be the type of authority (Fire, Police, etc.), the second drop down would be populated by cities based on the first choice, and the third will (hopefully) be a text field pre filled with the phone number.
Okay, I still can't figure out how to attach or upload a file here, so I've uploaded it to dropbox:
(You'll need to click the "Add" button button next to "Authority Numbers" to expand the area).
I had come across this (http://forums.adobe.com/message/1334821#1334821) as a potential solution, but I can't seem to figure out how to implement it correctly.
If anyone is able to give me some guidance, I'd really appreciate it!
When dealing with dropdowns the best event to use is the preOpen event. This means that there wouldn't be any script in the first dropdown.
Then in the second dropdown you would have a relative simple script that would look back at the user's selection in the first dropdown and then populate the display items in the second dropdown.
See examples here:
When adding an item to a dropdown, you can specify both the display item (what the user's sees) and the bound value (the value of the dropdown that is associated with the user's selection).
this.additem("Clonmel", "(052) 1234567");
This would add a city "Clonmel" to the dropdown and the value of the dropdown would be "(052) 1234567", if the user selected Clonmel.
The textfield can then be given the same name as the dropdown and its binding set to Global (see the object > Binding palette when the textfield is selected).
Hope that helps,
Thanks very much for the quick and helpful response. This looks to be exactly what I need!
I had been questioning my implemenation of what I already had in use, and this looks to be much more streamlined.
Is there a way to pre-select the first choice from the second drop down list, based on the first drop down list selection. For the "Null pattern for dropdown" example, if a user select Gender = Male, Relationship would default to Father, but the user can still use the dropdown list select Relationship equal something else like "Son" or "Uncle".
you can use the setItemState method to preselect a value in a dropdown list.
Select the first value (its index = 0) of drop down list 2 if "Male" is selected, else the second value.
if ($event.change eq "Male") then DDL2.setItemState(0, 1) elseif ($event.change eq "Female") then DDL2.setItemState(1, 1) endif
Europe, Middle East and Africa