What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.

  • Profile Image

    calculation form: summing two values

    Asked by pedroof 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
    JotForm Support

    Answered by Mike_T 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.