Categories | Question details Back To List | ||
Set option after loading dhtmlxCombo options from a XML file First of all thanks for your great JS components On our website I use a dhtmlxCombo which is loaded from an XML file. When a user enters the page he/she has sometimes already entered a value which we store in a database corresponding to the option value in the XML file. After loading the options into the dhtmlxCombo I would like to set the selected option. One way is to modify the XML to have a SELECTED value. Is there a nother way? XML example <?xml version="1.0" ?> <complete> <option value="" img_src="../images/Pictogram1/blank.gif">Pictograms</option> <option value="A" img_src="../images/Pictogram1/A.gif"></option> <option value="B" img_src="../images/Pictogram1/B.gif"></option> <option value="C" img_src="../images/Pictogram1/C.gif"></option> <option value="D" img_src="../images/Pictogram1/D.gif"></option> <option value="E" img_src="../images/Pictogram1/E.gif"></option> <option value="F" img_src="../images/Pictogram1/F.gif"></option> <option value="G" img_src="../images/Pictogram1/G.gif"></option> </complete> Could you please avise me how to set the option of the dhtmlxCombo corresponding to the value in the database? I have tried the following selectOption method and I have hardcoded index 2, but it does not update: response.Write "var z"&isignmessageid&"=new dhtmlXCombo("""&isignmessageid&""","""&isignmessageid&""",105, 'image');" response.Write "z"&isignmessageid&".loadXML(""../XMLPictograms/Pictogram1.xml"");" response.Write "z"&isignmessageid&".selectOption(2);" Kind regards Niels Answer posted by Support on May 15, 2008 07:43 The problem caused by async. way of XML loading, the command next to loadXML will be executed when data is not loaded yet You can use second parameter of loadXML function to catch the moment, when data already loaded and option can be selected response.Write "z"&isignmessageid&".loadXML(""../XMLPictograms/Pictogram1.xml"",function(){" Answer posted by Niels Jensen on May 16, 2008 00:37 That worked perfect! Thank you very much! kind regards Niels |