calculation form: summing two values

  • Profile Image
    Asked on April 15, 2013 at 04:30 PM

    Hello, please I need a css code calculation, the following happens requerir need two numbers and calculate them.

    for example, in a form of expenditure spent on someone fills the hotel and food, and form the sum 2 values .

    thank you

  • Profile Image
    Answered on April 15, 2013 at 05:22 PM

    We will need to use Javascript for this.

    Here is an example:

    I get the form source code, put it to my web page, and added a little summing Javascript function:

    <script language="javascript" type="text/javascript">
    function summing(){

    These highlighted values are referring to html elements, and will be different on your form.

    Also, I added a call to that function for inputs:

    <input type="text" class=" form-textbox" id="input_1" name="q1_hotelValue" size="20" onchange="javascript:summing();"/>
    <li class="form-line" id="id_3">
    <label class="form-label-left" id="label_3" for="input_3"> Food value </label>
    <div id="cid_3" class="form-input">
    <input type="text" class=" form-textbox" id="input_3" name="q3_foodValue" size="20" onchange="javascript:summing();"/>

    Please feel free to contact us if you need any more information. We will be happy to help.