Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by nelu on Aug 07, 2009 04:55
open dhtmlx forum
dhtmlxCombo

I'm using "100000" sample example
with database in mysql-- RandomWords

and function getDataFromDB($mask)

How can i set selected option in dhtmlxcombo (Ex. item_id=2 )


Thanks!
Answer posted by Alex (support) on Aug 07, 2009 05:21

In case of autocomplete (dynamic loading) you can select the option only on client (using combo API). And moreover option can be selected by the text:

combo.setComboValue(option_text);

Answer posted by nelu on Aug 07, 2009 06:55

I resolved my problem doing this in main page:

 <script>
   var z=new dhtmlXCombo("combo_zone","combo_zone",200);
   z.enableFilteringMode(true,"loadCombo.php");
   z.addOption("<?php echo $aaa ?>","<?php echo $bbb ?>");
   z.setComboValue("<?php echo $aaa?>");
 </script>

where variables $aaa (item_id), $bbb (item_nm) is from php-mysql select.... is simple :)