Conditional dropdown list's options (HELP)

Hello All,

I have seen a post about the conditional dropdown list’s options, and I have tried to follow the steps, but I got stuck on that…

Could someone try to explain a little more detailed how to create a conditional dropdown list…

Please, I’ve tried many ways…

Sorry about that…

I am not sure about what you mean by “Conditional” dropdown. However if you mean Dynamic dropdowns this is how you should proceed:

  1. Create the Child dropdown
    go to Admin->Developer Tools->Dropdown Editor->Add Dropdown
    in the Name field enter the name of your dropdown (for example “european_countries_list”) and then proceed below to add items to the list by filling the Item Name and Display Label textboxes and then click on the Add button.
    Here are some values:

Item Name: uk
Display Label: United Kingdom

Item Name: fr
Display Label: France

Item Name: it
Display Label: Italy

Item Name: es
Display Label: Spain

At the end of the process press the Save button and you have finished creating the parent dropdown

  1. Create Child dropdown
    go to Admin->Developer Tools->Dropdown Editor->Add Dropdown
    in the Name field enter the name of your dropdown (for example “european_cities_list”) and then proceed below to add items to the list by filling the Item Name and Display Label textboxes and then click on the Add button.
    Here are some values:

Item Name: uk_lon
Display Label: London

Item Name: uk_bham
Display Label: Birmingham

Item Name: uk_man
Display Label: Manchester

Item Name: fr_par
Display Label: Paris

Item Name: fr_lyo
Display Label: Lyon

Item Name: fr_nic
Display Label: Nice

Item Name: it_rom
Display Label: Rome

Item Name: it_mil
Display Label: Milan

Item Name: it_ven
Display Label: Venice

Item Name: it_flo
Display Label: Florence

Item Name: es_mad
Display Label: Madrid

Item Name: es_bar
Display Label: Barcelona

Item Name: es_val
Display Label: Valencia

At the end of the process press the Save button and you have finished creating the child dropdown

You will have noted that the cities from the United Kingdom are prefixed with uk_: this is the name of the item in the european_countries_list to which we added an underscore.
The same applies to other countries: es_, fr_, it_

If you sort these items you will note that the prefix is ignored in the sorting.

  1. Create the Parent field in Studio
    In this example we will add these fields to the Contacts module so go to Admin->Developer Tools->Studio->Contacts->Fields->Add Field

In the DataType select Dropdown
In Field name write: euro_country
in the Display Label write: European Country
in the Dropdown List select european_countries_list

Once done click on the Save button
(you will notice that, once you are taken to the list of fields, your field name will have a trailing _c that the system will have added to it so its name will be euro_country_c)

  1. Create the Child field in Studio
    In this example we will add these fields to the Contacts module so go to Admin->Developer Tools->Studio->Contacts->Fields->Add Field

In the DataType select DynamicDropdown
In Field name write: euro_city
in the Display Label write: European City
in the Dropdown List select european_cities_list
in the Parent Dropdown write: euro_country_c
(Note that this is the name of the field and not the dropdown)

Once done click on the Save button
(you will notice that, once you are taken to the list of fields, your field name will have a trailing _c that the system will have added to it so its name will be euro_city_c)

  1. Add the fields in the Edit Layout
    go to Admin->Developer Tools->Studio->Contacts->Layouts->Edit View

Drag a new row to the layout and in thje left filler drag the euro_country_c field and in the right filler drag the euro_city_c field

Then click on Save and Deploy and you can proceed to test.

5 Likes

Hi amariussi,

Thank you very much for your time once again…this was exactly what I would like to do…and I’ve done it like you said first, than I understand how this works…so I appreciate your patience to explain it to me…

if it’s ask too much, I would like to ask one more question…

Is it possible to create, more than one child dropdown ?

What I am trying to do is something like this.

Application: [ Application1, Application2, Application3]

Depends on the application it loads the subapplication, so I would have

Application1 = Sub1, Sub2, Sub3

And one more child dropdown, so again, depends on the subapplication, I would have a third category

Sub1 = Version1, Version2, Versio3
Sub2 = Version 3, Version6, Version7
Sub3 = Version9, Version11, Version10

In the form we would have 3 fileds then…

I’ve tried to create one more, but I could not make that work… is the name of the field must be the same… I’ve done like this

application_list (first dropdown)
application_sub_list (second dropdown)

First Field (dropdown) = Application (pointing to the application_list)

SecondField (dynamic dropdown) = Sub Application (poiting to the application_sub_list)
parent dropdown = application_list_c

for the next one I also have created a new dropdown child, created a new Field (also as Dynamic Dropdown), I pointed to the new_application_version
and for the parent dropdown I pointed it to the (application_sub_list_c)

is my understanding correct ???

sorry if I not explain very detailed, but if you would like to I do it…but my intentation so far is only to see if it can be done or not…

Thank you very much

better and simpler question, can be a dynamic dropdown be a child of another dynamic dropdown ?

thanks

Yes you can.

I have tested it with three levels only and it works. I assume you can have more.

Following my example above, imagine you want to add districts you would create a dropdown list with the dropdown editor called european_districts_list

Add the items to the list by prepending the item names of the cities so you could add:
uk_lon_ham -> Hampstead
uk_lon_tot -> Tottenham
uk_lon_ken -> Kensington

uk_bham_sel -> Selly Oak
uk_bham_har -> Harbourne
uk_bham_edg -> Edgbaston

fr_par_ope -> Opera
fr_par_sge -> Saint Germain des Prés

fr_nic_ang -> Promenade des Anglais

etc…

Then , in the contacts add a field euro_districts of type Dynamic Dropdown and with parent euro_city_c

To finish you add it to the Edit Layout and Save and Deploy

That’s it!

PS: more than welcome!!!

amariussi,

Thank you once again,

What I was doing wrong was about the sctructure

as the dropdownlist goes down, the last one should follow the same name as the first, so just to you see what I was doing

app_redbox_tdm

app_redbox_version (for the down dropdownlist)

and that’s wrong, the right would be

app_redbox_tdm

app_redbox_tdm_version (for the down dropdownlist)

and so on…

Now I see how I should create them…

if it wasnt for you I would still be stuck here…THANKS AGAIN

Hi guys,

I had the same problem but… now, I have another one: when creating the child dropdown menu, I do not find he dynamic dropdown option!
Why is this happening?

Thank you.

Luís

Hey lmbvm, this is really out of my league, but I hope the experts here can help you!! good luck!

1 Like

Hi juniorccs,

It was really simply. I have downloaded the Dynamic Dropdown addon from the internet ( from www.urdhva-tech.com) and its is done!

Thank you.

Luís

I hope someone can help me out here.

I have been trying to fetched dependent drop down values in cases advanced search.
there are two types of the drop down Type and Sub-Type, On advanced search page when user select the Type drop down then based on selected Type, Sub-type options should be populate.
I have implemented custom function to get sub-types in “Extension\application\Ext\Utils\function.php”

and in searchdefs.php called “getSubTypes” function.

'type' =>
array (
'type' => 'enum',
'default' => true,
'studio' => 'visible',
'label' => 'LBL_TYPE',
'width' => '10%',
'name' => 'type',
'displayParams' => array(
'size' => 1,
),
),
'sub_type' =>
array (
'type' => 'dynamicenum',
'default' => true,
'studio' => 'visible',
'label' => 'LBL_SUB_TYPE',
'width' => '10%',
'name' => 'sub_type',
'displayParams' => array(
'size' => 1,
),
'function' =>
array (
'name' => 'getSubTypes',
'params' =>
array (
0 => false,
),
),
),

But How to send Type drop down selected value to custom function?
there is another option in Studio to manage dynamic drop down, but it will only work for edit view and list view.
is there any way to set dynamic dependent drop down in advanced search?