EasyUI Forum
April 23, 2024, 08:47:59 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: in $(function(){ }) can't init easyui_form input ?  (Read 5331 times)
cdtuql
Newbie
*
Posts: 26


View Profile Email
« on: April 24, 2017, 10:33:52 PM »

I need to set value for the textbox input  when the page open,but it don't work ,how can i do?

 <tr>
      <td><s:message code="exchangeshift.page.currentshiftno" /></td>
      <td><input class="easyui-textbox" type="text" name="currentshiftno"    style="width:122px"/></td>
      <td><s:message code="exchangeshift.page.currentshiftno" /></td>
      <td><input id="bussiness_exchangeshift_bc"  style="width:80px"  name="shiftno" class="easyui-combobox" data-options="valueField:'shiftno',textField:'



$(function(){  
       alert(1);
        $.ajax({
            type:'POST',
            url:'${pageContext.request.contextPath}/exchangeshift/getCurrentExchangeShiftRec',
            success:function(data){
               console.log(data);
               $('#bussiness_exchangeshift_form').form('load',data);
               alert(data.bc.shiftno);
               $('#bussiness_exchangeshift_form  input[name=currentshiftno]').setValue(data.bc.shiftno);
               $('#bussiness_exchangeshift_form  input[name=currentbcseqno]').attr("value",data.shiftexchangeSeq);
               $('#bussiness_exchangeshift_form  input[name=fshiftExchangeReco_req]').attr("value",data.fshiftExchangeReco_seq);

               $('#business_exchangeshift_gunlog_grid').datagrid('load',data.gunexchangeshiftlogs);
               
            },

$('#bussiness_exchangeshift_form  input[name=currentshiftno]').setValue(data.bc.shiftno);
this did not work
But if I delete the class="easyui-textbox"  It worked?
can any one help me
« Last Edit: April 25, 2017, 07:46:24 PM by cdtuql » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: April 25, 2017, 11:56:37 PM »

You should call the 'setValue' method of textbox to modify the component's value.
Code:
<input id="currentshiftno" class="easyui-textbox" type="text" name="currentshiftno"    style="width:122px"/>
<script>
...
$('#currentshiftno').textbox('setValue',data.bc.shiftno);
</script>
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!