JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
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.
Using conditions in the calculation widgetAsked by firstname.lastname@example.org 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
This is a re-post of a comment on Form Calculation - Math Function Reference
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.
Thank you for waiting. Here's a GIF animation of the result:
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.
Hope that helps. Let us know if you need further assistance. Thank you.