Chained Selects Copyright 2004 Xin Yang The callback function can be set up for many purposes. For example, in a frameset case we can put the select lists in the top frame and load a page in the bottom frame when an option is picked. To do so, we can code the callback function this way: function loadPage(list, order, instance) { if (list.value!="") { parent.bottom_frame.location=list.value; } } ... <body onload="initListGroup('MyList', select-list-1, select-list-2, 'cookie_name', loadPage)"> Usually the number of select lists should be equal to the number of maximum nested levels in a list group. For a selection that doesn't have sub-options for its "child" select list, its "child" select list and all the "grand-child" select lists will be emptied. When a select list is emptied, you can choose to just leave it there, to disable it or to hide it. To disable empty lists, you can embed the following line before the include line of the function script:
a disabled list will be enabled when there are some options to pupolate it. To hide empty lists, you can embed the following line before the include line of the function script:
a hidden list will become visible when there are some options to pupolate it.
# Update History:
|