Expand my Community achievements bar.

How do make 3 dropdown menus dependant on each other.

Avatar

Level 2

HI GUYS,

I am new to livecycle designer and am building a form  that has 3 dropdown menus; 1st dropdown menu has a list of options e.g. E_COM, E_ENGS and by selecting this the second menu populates E_COM 1, E_COM 2 and when an item on the second menu is selected e.g E_COM 2, the third dropdown menus is populated with a list of options.

Please can anyone help? and show me how to write these in a Switch statement or how would you advice i do about doing this?.

thanks

4 Replies

Avatar

Level 7

You can use the preOpen event of each dropdown list to populate them. So your switch statement would use this.clearItems and then this.setItems(" , , ") for each option.

Avatar

Level 2

Hi Whyisthisme,

Please can you give me an example using the table below, how do i write this.

Dropdown 1Dropdown 2Dropdown 3
E_COMME_COMM_1_Ananlytical & Process50184419 - Analytical & Process
E_COMM_1_Asset Planning & Sourcing50139603 - Asset Planning & Sourcing
E_ENGCE_ENGC_1_Chemical Engineer50195825 - Chemical Enginner
E_ENGC_2_Chemical Engineer50195826 - Chemical Enginner

Avatar

Level 10

What I do with dropdownlist that needs autopopulating i usually create a script object.

The script object contains a multi-dimensional array that contains every value linked to each other

e.g.

var tabArray = new Array(["E_COMM",

                                             new Array(["E_COMM_1_Analytical & Process", new Array("50184419 - Analytical & Process", "..."],

                                                              ["E_COMM_1_Asset Planning & Sourcing", new Array("50139603 - Asset Planning & Sourcing", "..."])],

                                         ["E_ENGC",

                                             new Array(["E_ENGC_1_Chemical Engineer", new Array("50195825 - Chemical Engineer", "...")],

                                                              ["E_ENGC_2_Chemical Engineer", new Array("50195826 - Chemical Engineer", "...")])]);

tabArray[0][0] = "E_COMM"

tabArray[0][1] = Array()

tabArray[0][1][0][0] = "E_COMM_1_Analytical & Process"

tabArray[0][1][0][1] = Array()

tabArray[0][1][0][1][0] = "50184419 - Analytical & Process"

using a for loop with the array could look something like this

Avatar

Level 7

An example of how to do it in formcalc would be (in the preOpen statement of the 2nd dropdown):

if (DropDownList1 == "E_COMM") then

$.clearItems()

$.setItems("E_COMM_1_Ananlytical & Process,E_COMM_1_Asset Planning & Sourcing")

elseif (DropDownList1 == "E_ENGC") then

$.clearItems()

$.setItems("E_ENGC_1_Chemical Engineer,E_ENGC_2_Chemical Engineer")

endif

You could then do something similar in the 3rd box. The logic is the same for a java switch statement just the syntax is different.