Wait until load Combo

I have a little problem with a combo.



By default, in my xml file i have one record selected. But, when im load the combobox i can’t get the getSelectedValue(); property.



I don’t no why…



This is my code:



var cmbAnio=new dhtmlXCombo(“anio”,“alfa0”,120, ‘image’);

cmbAnio.attachEvent(“onSelectionChange”,ActSem);

//The function ActSem loads another combo. This works fine.



cmbAnio.setDefaultImage(“imgs/csh_vista/iconChecked.gif”);        



cmbAnio.loadXML(“combo.asp?tipo=5”);



//In this line returns NULL

alert(cmbAnio.getSelectedValue());





But if i have an Alert instruction before the instruction,the value is corrects. But i need get the value without the alert message.



Any suggestions?


Hello,


the second parameter of the loadXML method is a function that is called after xml loading:


cmbAnio.loadXML(“combo.asp?tipo=5”,doAfterXMLLoading);


function doAfterXMLLoading(){


alert(cmbAnio.getSelectedValue());


}

Perfect, thanks a lot.