Calculation script for fields with text
I have a form I am making that I have 3 fields that default value is N/A
I am trying to make a 4th field to add these 3 fields but the problem is if the field is not displaying a value then it the calculation script does not work. It only works if all 3 fields have a numerical value.
I have to have the field to display N/A if there is not a numerical value in it.
So my thoughts have been for the 4th field to convert the N/A value to 0 but how do I use the value if it is not N/A. I think I am over complicating it in my head and that is why I can't come up with a solution.
My original script:
var nDownPayment = this.getField("DEAL_PURCHASE_TRADE_TOTALNET1").value + this.getField("DEAL_PURCHASE_CASHDOWN").value + this.getField("DEAL_PURCHASE_REBATE").value;
if( nDownPayment > 0.00) event.value = this.getField("DEAL_PURCHASE_TRADE_TOTALNET1").value + this.getField("DEAL_PURCHASE_CASHDOWN").value + this.getField("DEAL_PURCHASE_REBATE").value;
else event.value = 0.00
but this script doesn't display a value if "DEAL_PURCHASE_TRADE_TOTALNET1" and "DEAL_PURCHASE_CASHDOWN" have the default value of N/A and "DEAL_PURCHASE_REBATE" has a value in it.
How do I get it to either ignore the first 2 fields if their value is equal to "N/A" or treat "N/A" as the value of 0 only for the purpose of the calculation script.
DEAL_PURCHASE_TRADE_TOTALNET1 & DEAL_PURCHASE_CASHDOWN & DEAL_PURCHASE_REBATE will always be either a numerical value or text "N/A"
Thanks in advance for any help in solving this.
