JavaScript Calculation Custom (100,000 - 0)/100,000*100 should equal 100 but I am getting blank
I am new to JavaScript and all of the fields work with this JavaScript except when I get to $0.00 in the f2 field and then it leaves the field blank. I want it to show 100. What do I need to add to the Script?
It is basically Loan Amount minus Balance divided by loan amount multiplied by 100 equals percent of loan
var f1 = Number(this.getField("LoanAmt").valueAsString);
var f2 = Number(this.getField("Bal5").valueAsString);
var f3 = Number(this.getField("Pct5").valueAsString);
if(f2)
event.value = (f1-f2)/f1*100;
else
event.value = "";
