EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: correohs on February 03, 2013, 10:44:47 AM



Title: Form : How should I assign a Value to an Input Box in a Form
Post by: correohs on February 03, 2013, 10:44:47 AM
How to assign a value to an input in a form?

I try to assign a value to an input box in a Form Container. I couldn't make it to work.
I made some work around. It works but I don't really like it =) [ see attachment ]

I read JavaScript or formatter function should help me on it  but I don't know how to do it.

Thanks for any help.  
I also Attached an screenshot for easy understanding of what I try to accomplish.


<form id="fm" method="post" novalidate>
-------------------------------------------------------------------------------
$i=0;
while ($row = mysql_fetch_array($result)) {
   $i=++$i;

//---------------------------------------------------------------------------------------
// I tried to assign a value to the input box directly from the db table and it didn't work so
// Assign the value to a variable and didn't work neither.
//---------------------------------------------------------------------------------------

$actidnumb[$i] = $row['act_id_numb'];    

    echo '<tr>';
   echo '<td class="even">' . $row['act_title_id_numb'] . '</td>'
   . '<td class="even">' . $row['title_code'] . '</td>'
   
    . '<td class="even">' . $row['act_desc'] . '</td>'
   . '<td align="right">' . $actidnumb[$i] . '</td>' ;

?>   

<!-- ----------------------------------------------------  -->
<!-- ** input value= 96                      It  Doesn't Work **  -->
<!-- ----------------------------------------------------  -->

<td><input name="actidnumb[]" class="easyui-validatebox" value="<? echo $actidnumb[$i]?>" type="text" size="3" maxlength="3"  /></td>  

<!-- I have tried  no luck neither ------------------------------- -->
<td><input name="actidnumb[]" class="easyui-numberbox" type="text" data-options="min:0,precision:2,value:96" size="4" maxlength="3"  /></input>

</td>

<td><input name="hours[]" class="easyui-numberbox" type="text" size="3" maxlength="5" /></td>
<td><input name="lo_desc[]" type="text" size="50"  maxlength="70" /></td>

</form>


Title: Re: Form : How should I assign a Value to an Input Box in a Form
Post by: correohs on February 04, 2013, 10:38:16 AM
<form id="fm" method="post" novalidate>

If I removed id="fm"

I can see all the values correctly. what is the impact to have id="fm"
I'm using the basic easyui sample that the site provide and I modify it for me needs.

Thanks


Title: Re: Form : How should I assign a Value to an Input Box in a Form
Post by: correohs on February 04, 2013, 10:49:29 AM
I renamend the form id to

form id="fm1"

than I modified the call area.

$('#fm1').form('submit'

function saveUser(){
         $('#fm1').form('submit',{
            url: url,
            onSubmit: function(){
               return $(this).form('validate');
            },