EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: putusundika on July 13, 2012, 04:07:23 AM



Title: Updating value of textbox from combobox
Post by: putusundika on July 13, 2012, 04:07:23 AM
basically i wanna retrieve my dtbase and populate as an items on combobox. And everytime i change or select the items, it will update value of other form component like (textbox).

this is work for me, but CMIIW

Code:
$().ready(function(){
 $('#id1').combobox({
  onSelect:function(record ){
   $('#id2').val(record.f3);
  }
 });       
});
----
<input id="id1" name="id1" style="width:300px" class="easyui-combobox"
url="database.php" valueField="f1" textField="f2" required="true">
<input type=text id='id2' size='20' disabled>
----
database.php:
$rs = mysql_query("select * FROM db");
//fileds : f1,f2,f3,f4
$items = array();
while($row = mysql_fetch_object($rs)){
array_push($items, $row);
}
echo json_encode($items);

regards
putu