How to prevent calculated fields from displaying zero?
I have a PDF form that does some simple arithmetic: taking numerical entries from the user, adding or subtracting them, and then displaying the results in another field. Right now, all my calculation fields display 0.00, and they update as you add data. But if an user would rather print the form and hand write the numbers, how do you prevent the form from displaying (and printing) 0.00 in the calculated fields? I've tried this, and it doesn't work:
var cash = this.getField("Total Cash on Hand");
var petty = this.getField("Petty Cash");
var diff = cash.value - petty.value;
if (cash.value == "NaN" || petty.value == "NaN") { event.value = "" } else event.value = diff;