mulitple Combobox + getselectedvalue

I would like to get the selected value back of the latest combobox. The problem is that i get a alert (“null”) when i load the page but not when i select another value in the combobox. Could someone help please ?



Thx



Here is my code:



    var z4=new dhtmlXCombo(“combo_zone4”,“alfa2”,200);

    

    z4.enableFilteringMode(true);

    z4.loadXML(“portfolio/1.xml”);

    var z5 = z4.setAutoSubCombo(“portfolio/2.php”,“alpha2”)

    var z6 = z5.setAutoSubCombo(“portfolio/3.php”,“alpha3”)

    

    z6.attachEvent(“onChange”,onChangeFunc(z6.getSelectedValue()));



    function onChangeFunc(key){

            alert(key);

        }

The approach of setting event handler is as follows:

    object.attachEvent(event_name,function_name)

So in case of your sample:
   
     z6.attachEvent(“onChange”,onChangeFunc);



The handler can be the following:

function onChangeFunc(){


    var value = z6.getActualValue();
   
    alert(value);

 
}

Thanks for the answer but i did now that already.
The problem that i have is that te function onChangeFunc is called when i open my page, when Z4 is loaded. not when Z6 is changed.
Z6 is shown when i change Z5, Z5 is shown when i change Z4 thats what i have and what i want.

Can you tell me why the event is alerting when the page is loaded en not when Z6 is changed.

Thx in advance.

The method, which you have used, is not the same with one we have recommended you. Please, look at it.

You have called onChangeFunc function with non-existent parameter when a page is loaded:

    z6.attachEvent(“onChange”,onChangeFunc(z6.getSelectedValue()));

But we have offered you the following - to set the event handler:
   
    z6.attachEvent(“onChange”,onChangeFunc);


From the onChange event handler you can get selected value using following approach:
  
    function onChangeFunc(){
       
        var value = z6.getActualValue();
        alert(value);

   
    }