Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Markus on Sep 12, 2009 06:30
open dhtmlx forum
SetText works only fine if I put an alert insinde the script

Hi,

my script work's not fine, but I don't know why.

        <div id="bank_title" name="bank_title" style="width:190px; height:22px;"></div>
    <script language="JavaScript" >
        var z=new dhtmlXCombo("bank_title","bank_title",190);
        
z.loadXML("data_<%if (session.getAttribute("lang_type") != null){ out.print(session.getAttribute("lang_type")); } %>.xml");


// alert();
z.setComboText("<%if (session.getAttribute("bank_title") != null){ out.print(session.getAttribute("bank_title")); } %>");
z.setComboValue("<%if (session.getAttribute("bank_title") != null){ out.print(session.getAttribute("bank_title")); } %>");





    </script>


I placed this empty alert inside and it works, if not the script only loads the xml.

Thanks for your help

Markus
Answer posted by Support on Sep 14, 2009 04:36
XML loading is async. , you can work with options only after data loading. 



z.loadXML("data_<%if (session.getAttribute("lang_type") != null){ out.print(session.getAttribute("lang_type")); } %>.xml",function(){
   //executed only after data loading

  z.setComboText("<%if (session.getAttribute("bank_title") != null){ out.print(session.getAttribute("bank_title")); } %>"); 
  z.setComboValue("<%if (session.getAttribute("bank_title") != null){ out.print(session.getAttribute("bank_title")); } %>");

});