EasyUI Forum
April 20, 2024, 02:42:07 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Poll
Question: Please help stworthy, I want to sum from two to one numberbox in the form..
Please help stworthy, I want to sum from two to one numberbox in the form.. - 1 (50%)
Please help stworthy, I want to sum from two to one numberbox in the form.. - 1 (50%)
Total Voters: 2

Pages: [1]
  Print  
Author Topic: The sum of two numberbox  (Read 5218 times)
cekone
Newbie
*
Posts: 4


View Profile
« on: January 05, 2017, 09:43:32 AM »

Please help stworthy, I want to sum from two to one numberbox in the form..

Code:
<fieldset id="fieldset">
       <div align="center" class="ftitle">Isi Form Pelanggan Baru</div>
            <form id="fm" method="post" novalidate>
                    <tr>
                        <td class="fitem">
                            <input id="tagihan_bln" name="tagihan_bln" class="easyui-numberbox" formatter="rupiah"   style="width:250px;height:30px;text-align:right" data-options="label:'Tagihan :',precision:0,groupSeparator:','" required="true"></td>
                        <td class="fitem">
                            <input id="potongan" name="potongan" class="easyui-numberbox" formatter="rupiah" style="width:250px;height:30px;text-align:right" data-options="label:'Fee :',precision:0,groupSeparator:','" required="true"></td>
                        <td class="fitem">
                            <input id="tagihan_sisa" name="tagihan_sisa" class="easyui-numberbox" formatter="rupiah" style="width:250px;height:30px;text-align:right" data-options="label:'Sisa :',precision:0,groupSeparator:','" onChange="true" readonly="true"></td>
                    </tr>
            </form>
</fieldset>

//code
$('#fm').form('load');
        var a = $('#tagihan_bln').numberbox('getValue');
        var b = $('#potongan').numberbox('getValue');
        var sum = a.numberbox('getValue')-b.numberbox('getValue');
        $('#tagihan_sisa').numberbox('setValue',sum);
« Last Edit: January 05, 2017, 09:45:51 AM by cekone » Logged
gunmo
Newbie
*
Posts: 5


View Profile Email
« Reply #1 on: January 05, 2017, 07:27:53 PM »

well,a is already the value of the first numberbox,and b is the value of the second numberbox.You needn't to get value again when you sum.
Code:
var sum = a - b;
Logged
cekone
Newbie
*
Posts: 4


View Profile
« Reply #2 on: January 05, 2017, 10:29:53 PM »

ok, that's the way I tried, but it still does not work. value can not be contained in var a and var b.
Logged
gunmo
Newbie
*
Posts: 5


View Profile Email
« Reply #3 on: January 05, 2017, 11:39:44 PM »

Do you have write a method to excute these code?You can also write a method  on "onchange" event.
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!