Highlighted

Dynamic Drop Down

Avatar

29-07-2008

New to LiveCycle, and am looking for a way to have a dropdown box only display data based on the entry in another dropdown box. For example if I have a State Dropdown, that list's all the States and then a City Dropdown that would only List City's within the State selected in the State Dropdown.

Replies

Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

30-07-2008

Where are the list of cities going to come from .....will you hard code it? Are they in a DB?



Doing what you ask is not that difficult, getting the data to populate the DD is the key.
Highlighted

Avatar

30-07-2008

Hardcode would be prefered, users that will use the form, will not always be connected to a network, when they are filling the form out.
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

30-07-2008

Then it is simply a matter of coding .... On the exit event of the 1st dropdown you can check the rawValue property (to let you know what the user selected and then use a select statement (Javascript case statement) then programatically add the items to DropDown2.
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

30-07-2008

There is a complex example that ships with Designer. Goto the install directory, then EN/Samples/Purchase Order/Dynamic Interactive/Forms



The country and state/province does what you want.
Highlighted

Avatar

14-08-2008

Hi, been trying to follow the example in the Purchase Order Form, but very much an amateur at writing code. My main problem is I don't understand where the information to populate the lists comes from - is it in the scripting, or is there another location for information that I don't know about?

Similarly to the other guy, I need to have it hardcoded, but I'm just a gumby in writing code. Have read through the FormCalc user guide, and it simply doesn't make sense when you have no programming background!

Hope I can get some help,

Thanks!
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

14-08-2008

The code is in a scripting object and it uses a very complex means to do it. If you are not familiar with code then you will not understand it. Can you hard code the values in the object itself?
Highlighted

Avatar

14-08-2008

Hi Mj Harvey,

The list comes from the script. Script is defined in the Script Object named "countryScript". myCountries array holds the countries with states.

myCountries[1][0] = "Canada"; // The first data value is the country name,

myCountries[1][1] = "Alberta"; // the rest are states/provinces.

myCountries[1][2] = "British Columbia";

myCountries[1][3] = "Manitoba";



In the change event of country field,

countryScript.getStatesOther(xfa, drpOrderedByStateProv);

is called. If you search the getStatesOrder function, by using addItem function new dropdown is filled.

Hope you catch.

Asiye