Answered
I am trying to calculate a discount, but the discount is only available if a text field is filled (Sponsor Membership No). After reading lots of forum posts, I tried this:
var sub = +getField("Subtotal").value; var sps = +getField("Sponsor Membership No"); if (sps == Null) { event.value = ""; } else { event.value = sub * 0.2; }
I also need this to be a negative number, but I can't even get it working as a positive. I hope someone can show me where I went wrong. Thanks.
But this is a bit more straighforward:
And better yet:
You forgot to get the value of the field. Also, a field value will never be equal to the special JavaScript value of null (not Null), so it's misleading to test for it.
George