Checking for form fields for zero value(s) before performing a calculation; such as percentage
I have a calculated field that is formatted as a percentage and references two other fields. I am checking for zeros before doing the calculation. The answer is correct but I get an error about the formatting of the answer when zeros are found.
I am using the following code which I got from an answer by try67 ...
var v1 = Number(this.getField('testWt').valueAsString);
var v2 = Number(this.getField('ratedCap').valueAsString);
if (v2 == 0 || v1 == 0) event.value = '';
else event.value = v1 / v2;
How can I stop the error message as I want the answer as a percentage?
