CCF plugin – Disable calculation with negative numbers
-
Hello,
I have created a conversion calculator using the Calculated Field Forms plugin. I would like to only allow calculations with positive numbers (equal or greater than 0). In the form settings I already have set the minimum value to 0, so when a negative number is written, the field shows the error message as it should be, however the form still calculates and shows a result. What should I write in the equation so it doesn’t perform the calculation? In the equation editor I have already the following equation that limits the result to 2 decimal places:
(function(){
function countDecimals (value) {
if ((value % 1) != 0)
return value.toString().split(“.”)[1].length;
return 0;
};var result = fieldname11*14.5;
if(2<countDecimals(result)) return PREC(result,2);
return result;
})()Thank you,
- The topic ‘CCF plugin – Disable calculation with negative numbers’ is closed to new replies.