- JBLAsked 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?
- JotForm SupportNik_CAnswered on February 22, 2017 at 07:03 PM
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.
- JBLAnswered on February 23, 2017 at 07:56 AM
Thank you for looking into it. I will try your solution.