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

    Adding two values together?

    Asked by solid6design on October 07, 2011 at 01:58 PM

    Is there a way I can pre populate a text box with a value of 2 other textboxes?

    Ex:

    How much did you spend today:  $5

    How much did you spend yesterday:  $4

     

    Total:  $9    <--adding the two entrys together

     

    If you look at the link where I am using the form, I want to be able to autofill the "Total commitment" for the user before sending

    Page URL:
    http://foxriverchristian.org/iwill/commit.html

  • Profile Image

    Answered by yasinco on October 07, 2011 at 02:01 PM

    This is a very good question but i'm not sure if it is possible, a jotform support rep will help you soon and I will also look into to this.

    I hope this helps.

    ~Yasin

  • Profile Image

    Answered by yasinco on October 07, 2011 at 02:03 PM

     Have looked into it and its not available, sorry. For more information please go to the following thread:

    http://www.jotform.com/answers/47384-Can-jotform-multiply-the-numerical-values-from-two-scale-grading-fields-and-produce-a-resulting-value

    ~Yasin

  • Profile Image
    JotForm Support

    Answered by abajan on October 07, 2011 at 03:03 PM

    Having looked at the form in question, judging form the third field's sub-label, what you actually want is for that field to display the total of the other fields multiplied by 2. Is that not correct?

    At any rate, the only way that I know of to add such functionality to the form would be to embed its full source into page and add JavaScript somewhat similar to those described in this thread. (The script for your form would likely be much less complex than any of those. Hopefully, I can adapt one of them to fit your requirements.)

  • Profile Image
    JotForm Support

    Answered by abajan on October 07, 2011 at 11:15 PM

    Okay, here's the solution:

    Follow these instructions and remove the currency symbols from the hint examples of the three fields in question because if a user were to enter (say) "1000.00" in the What I normally give in a year field and "5000.00" in the My expanded generosity for "I Will...", "12000.00" would be automatically inserted into the My two year "I Will..." commitment field, on focus. However, if the user were to enter "$1000.00" and "$5000.00" respectively, the third field would just have "NaN" (Not a Number - an error).

    Please let us know if this solution meets your need.

  • Profile Image
    JotForm Support

    Answered by abajan on October 08, 2011 at 05:50 PM

    I was later to discover that in order for this solution to work correctly in Internet Explorer 8 (and possibly some other browsers) the hint examples will need to be replaced with hover texts or the currency symbol removed from the hints. Otherwise, the form will load with "NaN" in the third field. Since the form in question is rather narrow, the hover texts will have to be repositioned and their arrows moved. Please see this clone of your form that you may in turn clone to view its injected CSS.

  • Profile Image

    Answered by solid6design on October 11, 2011 at 10:25 PM

    Yeah Dude, this works! Thanks a bunch!

    Good work!

  • Profile Image

    Answered by solid6design on October 11, 2011 at 10:41 PM

    For the future searchers.. Once I cloned the form, I did have to change the Form ID in the function

    a = document.form_12832746805.q1_whatI.value
    b = document.form_12832746805.q3_myExpanded.value

    and re add the:

    onfocus="totalx2();"
    on the input code for field 4.

    Thanks again for the help!
  • Profile Image
    JotForm Support

    Answered by abajan on October 12, 2011 at 02:39 AM

    Quite true. I forgot to mention that. Anyway, glad to help.