The Plugin Field Select Dynamic Cascade can be used with 2 modes:
- Construction: the query which will populate de select is predefine. You just have to fill the different inputs with good names.
- Free: You write the query entirely like you need.
The Construction mode is describ in Select dynamic Cascade Product Sheet.
In this tutorial, we will see how to work with the free mode.
The goal is to allow the user to select the city in which he lives by first selecting the region and the department and the city.
So, for the example, we will work with 3 tables:
Regions: #__cck_more_regions
Departments: #__cck_more_departments
Cities: #__cck_more_cities
the first Select "Region"
SELECT nom AS text, id AS value FROM #__cck_more_regions ORDER BY text
The second Select "Department"
SELECT nom AS text, id AS value FROM #__cck_more_departments WHERE region_id= #parent_id# ORDER BY text
The Last Select "City"
SELECT nom AS text, id AS value FROM #__cck_more_cities WHERE departement_id= [parent] ORDER BY text