Hi:

I have following code (compile with template) and data is dynamically generated from database
Code:
<script type="text/javascript">
var list_clubs_level_1 = new Array();
var list_clubs_level_2 = new Array();
var list_clubs_level_3 = new Array();
var list_clubs_level_4 = new Array();
var list_clubs_level_1_name = new Array();
var list_clubs_level_2_name = new Array();
var list_clubs_level_3_name = new Array();
var list_clubs_level_4_name = new Array();
var count = 0;
list_clubs_level_1[count] = 1;count = count+1;
list_clubs_level_1[count] = 8;count = count+1;
list_clubs_level_1[count] = 9;count = count+1;

count = 0;
list_clubs_level_2[1] = new Array();list_clubs_level_2_name[1] = new Array();
list_clubs_level_2[1][count]= 2;list_clubs_level_2_name[1][count]= 'A Test Forum';count = count+1;
list_clubs_level_2[1][count]= 5;list_clubs_level_2_name[1][count]= '2nd level';count = count+1;
list_clubs_level_2[1][count]= 18;list_clubs_level_2_name[1][count]= 'New Forum 2';count = count+1;
list_clubs_level_2[8] = new Array();list_clubs_level_2_name[8] = new Array();
list_clubs_level_2[8][count]= 10;list_clubs_level_2_name[8][count]= 'Žirmūnai';count = count+1;
list_clubs_level_2[8][count]= 11;list_clubs_level_2_name[8][count]= 'Antakalnis';count = count+1;
list_clubs_level_2[8][count]= 22;list_clubs_level_2_name[8][count]= 'Fabijoniškės';count = count+1;
list_clubs_level_2[8][count]= 23;list_clubs_level_2_name[8][count]= 'Šeškinė';count = count+1;
list_clubs_level_2[9] = new Array();list_clubs_level_2_name[9] = new Array();
list_clubs_level_2[9][count]= 16;list_clubs_level_2_name[9][count]= 'Žaliakalnis';count = count+1;

count = 0;
list_clubs_level_3[2] = new Array();list_clubs_level_3_name[2] = new Array();
list_clubs_level_3[2][count]= 3;list_clubs_level_3_name[2][count]= 'sub forum';count = count+1;
list_clubs_level_3[2][count]= 19;list_clubs_level_3_name[2][count]= 'New Forum 3';count = count+1;
list_clubs_level_3[2][count]= 20;list_clubs_level_3_name[2][count]= 'New Forum 6';count = count+1;
list_clubs_level_3[2][count]= 21;list_clubs_level_3_name[2][count]= 'New Forum 7';count = count+1;
list_clubs_level_3[5] = new Array();list_clubs_level_3_name[5] = new Array();
list_clubs_level_3[18] = new Array();list_clubs_level_3_name[18] = new Array();
list_clubs_level_3[10] = new Array();list_clubs_level_3_name[10] = new Array();
list_clubs_level_3[10][count]= 12;list_clubs_level_3_name[10][count]= 'Kareivių';count = count+1;
list_clubs_level_3[11] = new Array();list_clubs_level_3_name[11] = new Array();
list_clubs_level_3[11][count]= 14;list_clubs_level_3_name[11][count]= 'Antakalnio g.';count = count+1;
list_clubs_level_3[22] = new Array();list_clubs_level_3_name[22] = new Array();
list_clubs_level_3[23] = new Array();list_clubs_level_3_name[23] = new Array();
list_clubs_level_3[16] = new Array();list_clubs_level_3_name[16] = new Array();
list_clubs_level_3[16][count]= 17;list_clubs_level_3_name[16][count]= 'Žalioji';count = count+1;

count = 0;
list_clubs_level_4[3] = new Array();list_clubs_level_4_name[3] = new Array();
list_clubs_level_4[3][count]= 4;list_clubs_level_4_name[3][count]= 'test forum';count = count+1;
list_clubs_level_4[3][count]= 7;list_clubs_level_4_name[3][count]= '3d level';count = count+1;
list_clubs_level_4[19] = new Array();list_clubs_level_4_name[19] = new Array();
list_clubs_level_4[20] = new Array();list_clubs_level_4_name[20] = new Array();
list_clubs_level_4[21] = new Array();list_clubs_level_4_name[21] = new Array();
list_clubs_level_4[12] = new Array();list_clubs_level_4_name[12] = new Array();
list_clubs_level_4[12][count]= 13;list_clubs_level_4_name[12][count]= '19';count = count+1;
list_clubs_level_4[14] = new Array();list_clubs_level_4_name[14] = new Array();
list_clubs_level_4[14][count]= 15;list_clubs_level_4_name[14][count]= '10';count = count+1;
list_clubs_level_4[17] = new Array();list_clubs_level_4_name[17] = new Array();

	function getRef(id)
	{
		var ref = document.getElementById(id);
		return ref;
	}
	function emptySelect()
     {
     	var selectbox=getRef('list_clubs_select_2');
       	for (i=selectbox.length;i>=0;i--)
       	{
          	selectbox.options[i]=null;
        	}
        	var selectbox=getRef('list_clubs_select_3');
       	for (i=selectbox.length;i>=0;i--)
       	{
          	selectbox.options[i]=null;
        	}
        	var selectbox=getRef('list_clubs_select_4');
       	for (i=selectbox.length;i>=0;i--)
       	{
          	selectbox.options[i]=null;
        	}
      }
      function fillSelect2()
      {
        	emptySelect();

        	var selectbox1=getRef('list_clubs_select_1');
        	var selectbox2=getRef('list_clubs_select_2');
        	
       	var use_index=selectbox1.selectedIndex;
        	if (use_index == 0)
        	{
         		// Need all of selectbox2 possibilties
         		for(i=0;i<list_clubs_level_1.length;i++)
         		{
            		my_index=list_clubs_level_1[i];
            		alert(my_index);
            		alert(list_clubs_level_2_name[my_index][0]);
            		alert(list_clubs_level_2_name[my_index][1]);
            		alert(list_clubs_level_2_name[my_index][2]);
            		for (ia=0;ia<list_clubs_level_2[my_index].length;ia++)
          		{
              			myOption = new Option(list_clubs_level_2[my_index][ia],list_clubs_level_2_name[my_index][ia]);
              			optionPos = selectbox2.options.length;
              			selectbox2.options[optionPos]=myOption;
            		}
          	}
        	}
        	
      }
      function fillSelect3()
      {
        	emptySelect();

        	var selectbox1=getRef('list_clubs_select_1');
        	var selectbox2=getRef('list_clubs_select_3');
        	
       	var use_index=selectbox1.selectedIndex;
        	if (use_index == 0)
        	{
         		// Need all of selectbox2 possibilties
         		for(i=1;i<list_clubs_level_1.length;i++)
         		{
            		my_index=list_clubs_level_1[i];
          		for (ia=0;ia<list_clubs_level_2[my_index].length;ia++)
          		{
              			myOption = new Option(list_clubs_level_2[my_index][ia],list_clubs_level_2_name[my_index][ia]);
              			optionPos = selectbox2.options.length;
              			selectbox2.options[optionPos]=myOption;
            		}
          	}
        	}
        	
      }
      function fillSelect4()
      {
        	emptySelect();

        	var selectbox1=getRef('list_clubs_select_1');
        	var selectbox2=getRef('list_clubs_select_4');
        	
       	var use_index=selectbox1.selectedIndex;
        	if (use_index == 0)
        	{
         		// Need all of selectbox2 possibilties
         		for(i=1;i<list_clubs_level_1.length;i++)
         		{
            		my_index=list_clubs_level_1[i];
          		for (ia=0;ia<list_clubs_level_2[my_index].length;ia++)
          		{
              			myOption = new Option(list_clubs_level_2[my_index][ia],list_clubs_level_2_name[my_index][ia]);
              			optionPos = selectbox2.options.length;
              			selectbox2.options[optionPos]=myOption;
            		}
          	}
        	}
        	
      }
</script>
<select id="list_clubs_select_1" name="list_level_select_1" onchange="javascript:fillSelect2();">

<option value="1">A Test Category</option>

<option value="8">Vilnius</option>

<option value="9">Kaunas</option>

</select>

<select id="list_clubs_select_2" name="list_level_select_2" onchange="javascript:fillSelect3();">

</select>	
<select id="list_clubs_select_3" name="list_level_select_3" onchange="javascript:fillSelect4();">
</select>
<select id="list_clubs_select_4" name="list_level_select_4">
</select>
I am not sure about the error, but when I change the value of <select>, it's not working.

Right now, I am testing it with only first <select>.

Thanks