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

Avatar

15-08-2008

Hi Asiye,

I "kinda" get what you mean, but I don't know enough about naming of Script Objects, fields and using the addItem function to know how they link together - think dumber for me!! I understand how to have the different countries and states being input into an array, but where does the "array" fit into it? I have looked at the scripts in the Purchase order form, and they say:

'countryScript.getCountries(this);' but I don't know where or what 'this' is. The other thing is, I don't know the definition in this sense of what 'hard code' is. I thought I did, but apparently not.



I feel like I'm almost getting it, but sorry, not quite there yet. Could I ask for a little more help?



Thanks to both of you so far.

Avatar

15-08-2008

Hi Mj Harvey,

In Script objects you can define your general scripts of your form and functions. You can right click of the form in the hierarchy palete and clicking "Insert Script Object" will create a new script object with blank name. This object will be under the "Variables" in the hierachy. You can rename this object by F2 to your desired (as myScriptObject).

When you click on the script object on the hierachy, in the script panel you can define your arrays and functions. Define an double sized array as stateArr (as in Purchase Order). After define the same function stateOrder as in Purchase order.

In the dropdown change event, in script panel: you can call this function as myScriptObject.stateOrder(....) as in Purchase order. If you could not achive you can send me email asiye.aydin@gmail.com.



Asiye

Avatar

22-08-2008

I need to do something slightly similar.



I have two drop-downs for a hotel reservation-type application. The first is for the check-in date, the second for check-out date. If check-in is input first, check-out must have a later date and vice versa.



Is this an easy effect to achieve?



Many Thanks

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

24-08-2008

Yes ....it is easiest to deal with dates when yu convert them to an epoch (the number of seconds that have expired since a set moment in time). If you do this as long as the checkout date number is later than the checkin date then you know you are OK. There are commands for this is both FormCalc and JavaScript.

Avatar

26-08-2008

Thanks.



How about if I want to achieve the same effect but with integers rather than dates? For example, two drop-down boxes with values from 0-9 - the second drop-down cannot contain a value less than the first drop-down.

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

26-08-2008

That is easier that the previous means as you can get the DropDown.rawValue property and compare it to the 2nd one ....a much easier set of commands.

Avatar

29-08-2008

Hello,



i have a pull down menu and 2 other pull down menus hidden. When a choice is chosen from the first menu I would like one of the other ones to appear. Can someone help me out with a statement I can do this with. I think Its an If statement I'm looking for.

1st menu only has 2 items in the menu.



I got it to work with a radio button useing the click feature:

Subform4.presence = "hidden";

Subform3.presence = "visible"



I really want the pull down menu instead of the radiobutton.



Please help, thanks Lucy

Avatar

04-09-2008

Paul,

Thanks for the recommendation to use the Purchase Order sample -- the script object worked well for my application. However, there is one problem with this script. If you select "Canada" as the country and "British Columbia" as the state/province, and then change the country to "United States", "British Columbia" remains in the state/province field unless you reselect a state. This means a non-permitted country/state combination can be retained in the form.



Do you have a fix that clears the state field when the country field is changed and then populates the drop down with the appropriate states? Thanks for your help.

Dale

Avatar

04-09-2008

Hi Dale,

You can make state combobox empty in the change event of country combobox. In the change event check the previous value with changed value, and if they are not equal, make state combobox empty.



If you need the script solution as well, you can mail me.



asiyegunaydin@kgc.com.tr

Asiye