Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Manuel GR on Jun 16, 2009 09:43
open dhtmlx forum
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?
Answer posted by Alex (support) on Jun 17, 2009 02:30

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());

}

Answer posted by Manuel GR on Jun 17, 2009 07:25
Perfect, thanks a lot.