Articles

Chain Select List

Chain Select List
Chain Select ListClick to watch
4:6 minutes
2383 views
Average: 4.33
Votes: 6
Chained Selects lets you "chain" multiple select lists together so that the selection in a "parent" list can tailor the options available in a "child" list. Chained Selects supports unlimited unlimited number of "chains" in in a form.

In order to Create a chain select list you have to use the SQL Form Field and the fields will be loaded using AJAX JSON Calls.

The first option of a Chain select list can also be a Radio list.

 

SQLs used in this tutorial for Joomla 1.6+:

Field You Prefer:

SELECT DISTINCT type AS text, type AS value
FROM #__ce_cv
WHERE published=1
ORDER BY type ASC

Field Select:

SELECT name AS text, value
FROM #__ce_cv
WHERE published=1 AND type='{selectresult}'
ORDER BY text ASC

Getting Country and States from VirtueMart

Setting up the State:

  1. Go to the Custom Field Manager and Hit the new button;
  2. Select the SQL custom field type;
  3. Add the SQL query to the value field in order to create theStatedropdown;:
  4. SELECT state_name AS text, state_id AS value 
    FROM #__vm_state
    WHERE country_id = '{selectresult}';
  5. Set Use chain selectYes;
  6. Set Field to update to your City field; (in case you have a city database table)
  7. Select it's category;
  8. Save the custom field;

Setting up the Country:

  1. Go to the Custom Field Manager and Hit the new button;
  2. Select the SQL custom field type;
  3. Add the SQL query to the value field in order to create the Country dropdown:
  4. SELECT country_name AS text, country_id AS value 
    FROM #__vm_country
    WHERE 1;
  5. Set Use chain select to Yes;
  6. Set Field to update to your state field;
  7. Select it's category;
  8. Save the custom field;

 

 

Joomla 1.5 Native SQLs used in this tutorial for Joomla 1.5:

Field You Prefer:

SELECT DISTINCT type AS text, type AS value
FROM #__contact_enhanced_cv
WHERE published=1
ORDER BY type ASC

Field Select:

SELECT text, value
FROM #__contact_enhanced_cv
WHERE published=1 AND type='{selectresult}'
ORDER BY text ASC

Newsletter

captcha

Connect with us

We're on Social Networks. Follow us & get in touch.
You are here: Start page