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.
Preventing Negative Values in Form Calculation WidgetAsked by JBL on February 22, 2017 at 03:47 PM
I need to prevent negative values from being entered as gratuity.
I used the formula "max (0, )" to prevent negative values from being entered. This results in a default of 0 in the field. I prefer to have the field remain blank. Is there any other way to prevent negative values from being entered?
Unfortunately, with Form calculations widget I don't see the way to do that since as soon as you click the field involved in calculation number zero is inserted no matter what. But, it is possible with regular number field.
I used a simple example with two numbers that are calculated and shown in calculation field (also number field):
I created two calculation fields that are identical with identical calculation max(0,number1-number2):
I created two fields because we need to check if the field is zero, insert blank into it. And we can not do that with the same field, we need to have a temp one which is calculation number 1 (note: you can make those two fields be named the same).
Also, I created a calculation that if calculation number equals zero insert blank into calculation number1:
And finally, if calculation number equals zero I show calculation number1(which is with blank space already):
And I hide the calculation number (the original one) which is with zero in it.
Since they do the same calculation your user will not even notice when they change (again, you can make them name the same).
I understand it is not an elegant solution, but that is what I came out to.
Please let us know your thoughts.
Thank you for looking into it. I will try your solution.