Try this )I hope I didn’t do any mistake, but it should work if you follow these instructions):
(if you need to generate a list faster, if you have the list of all the countries, conties and citiesl in a mysql database, I think I can help you too to avoid you entering all the data by hand, but you need to have the database)
- Create the Countries dropdown
go to Admin->Developer Tools->Dropdown Editor->Add Dropdown
in the Name field enter the name of your dropdown (for example “my_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
- Create 1st level Child dropdown
go to Admin->Developer Tools->Dropdown Editor->Add Dropdown
in the Name field enter the name of your dropdown (for example “my_counties_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_rm
Display Label: Rome
Item Name: it_ml
Display Label: Milan
Item Name: it_ve
Display Label: Venice
Item Name: it_fi
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 counties from the United Kingdom are prefixed with uk_: this is the name of the item in the 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.
- Create 2nd level Child dropdown
go to Admin->Developer Tools->Dropdown Editor->Add Dropdown
in the Name field enter the name of your dropdown (for example “my_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: mi_mi
Display Label: Milan
Item Name: mi_as
Display Label: Assago
Item Name: mi_sd
Display Label: San Donato
Item Name: fi_fi
Display Label: Florence
Item Name: fi_sc
Display Label: Scandicci
Item Name: rm_rm
Display Label: Rome
Item Name: rm_an
Display Label: Anguillara
Item Name: rm_la
Display Label: Ladispoli
At the end of the process press the Save button and you have finished creating the child dropdown
- 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: my_country
in the Display Label write: Country
in the Dropdown List select my_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 country_c)
- 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: my_county
in the Display Label write: County
in the Dropdown List select my_counties_list
in the Parent Dropdown write: my_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 my_county_c)
- Create the second level 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: my_city
in the Display Label write: City
in the Dropdown List select my_cities_list
in the Parent Dropdown write: my_counties_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 my_city_c)
- Add the fields in the Edit Layout
go to Admin->Developer Tools->Studio->Contacts->Layouts->Edit View
Drag a new row to the layout
In the left filler drag the my_country_c field and in the right filler drag the my_county_c field
Drag a new row to the layout
In the left filler drag the my_city_c field
Then click on Save and Deploy and you can proceed to test.