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

    conditional threshold calculations

    Asked by dleflang on January 23, 2012 at 01:16 AM

    Hello,

    I have 3 different types of calculations:

    1) Add (x+ field value), also to display in form

    2) Add numerical field value to another numerical field value, also display in form

     3) Conditional threshold:

    If A + B > 10, prepop field C with "High"

    Or

    If A + B < 10, prepop field C with "low"

     

    are these possible?

    I assume the souce code will need to be edited and uploaded? 

    Could you please suggst how the to go about the code?

     

    Thank you

    Dave

    Page URL:
    http://www.jotform.com/form/20220510560

  • Profile Image

    Answered by fxr on January 23, 2012 at 07:23 AM

    hello Dave,

    Yeah, you would need to upload source code again. 

    Get the form uploaded somewhere and I will have a go the javascript. I am just a little concerned about the reusability of the code, I assume your aim is use these types of calculations on a few different forms? I will try and streamline that process of reusing the code on multiple forms as much as possible. 

    --

    I will summarise your desired calcs below

    Field + number :-> Add Number

    Field1 + Field 2 :-> Add fields

    is field1 + field2 > of < Number (10)  :-> added fields higher or lower than number

  • Profile Image

    Answered by dleflang on January 23, 2012 at 07:31 PM
    Reusability would be nice, but for now let’s just see if it can work:
    https://dataramp.com/dataramp/form/20222332559?

    Also, the first 2 summaries you have correctly.
    The last one, you may have it right, I am not sure. Here is how I would state it:
    Field1 + Field 2 :-> Add fields, if sum is greater than x, then show y in field 3. If sum is less than x, then show z in field 3.
    Thank you
    Dave
  • Profile Image

    Answered by fxr on January 23, 2012 at 07:37 PM

    OK, Dave I will have a go at that tomorrow. 

    I don't envisage too many problems.

    Thanks for the clarification on the 3rd one, the aim of that summarising was to try and arrive at 'nicknames' for each calc so we quickly knew which one any of us was refering if we needed to talk about it. Also felt it would aid in any comments/variable names etc in any code that could be reused. 

    Anyway, you should see something back from me at some point tomorrow. 

  • Profile Image

    Answered by dleflang on January 23, 2012 at 07:44 PM
    Thanks!

  • Profile Image

    Answered by fxr on January 24, 2012 at 05:42 AM

    OK, heres the script that will make those calcs work on that form:

    http://pastie.org/3242631

    Add that just before your closing </body> tag.

    I have tried to make the code as reusable as possible; you just need to update the relevant variables names with any new element IDs for a particular field. 

    Test webpage/form is here 

    Let me know if you have any questions on that.