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

    Using conditions in the calculation widget

    Asked by info@pdfn.co on March 11, 2016 at 07:23 AM

    Is it possible to output a fiksed value to a field, if calculation for it results in lower value? For example if a+b < 10, then output 10, if not output result for a+b

    Thank you.

    This is a re-post of a comment on Form Calculation - Math Function Reference

  • Profile Image
    JotForm Support

    Answered by Jan on March 11, 2016 at 08:28 AM

    This is possible in JotForm. I'll get back to you once I'm done with demo and the instructions. Thank you for your patience.

  • Profile Image
    JotForm Support

    Answered by Jan on March 11, 2016 at 09:08 AM

    Thank you for waiting. Here's a GIF animation of the result:

    Please check this demo form: https://form.jotform.me/60703187512451
    You can clone it if you like to study how it was build.

    Here are the steps on how I did this:

    1. I created 3 text boxes (A, B, and Output).

    2. I used the "Form Calculation" widget in order to calculate the total of A and B. 

    3. I created a formula that will add the field A and field B.

    4. I make sure that the default value of the calculation widget is "blank" and not 0.

    5. Now that we're done with the form fields, we can now apply conditions. Click the "Conditions" button in the toolbar. We'll be using the "Update or Calculate a field" condition.

    6. You need to create conditions where if the total of A+B is less than, it will put 10 in the Output field. If it is greater than 10, it will copy the total to the Output field.

    7. Here's the summary of 2 conditions.

    If the "Calculation" field is greater (>) than 10, then it will copy its value and put it on the "Output" field.

    If the "Calculation" field is less (<) than 10, then it will put "10" on the "Output" field.

    Related Guides:

    Hope that helps. Let us know if you need further assistance. Thank you.