JavaScript Newbie Trying to Figure out an If/Then/Else depending on if a Field is Blank
Hi All!
So I've been googling, but I think I don't fully understand how to tell javascript what I want to do.
I'm trying to get a total in Field4 based on three other fields, Field1, Field2, Field3.
If Field 3 is blank, I want the minimum of Filed 1 and Field 2. Otherwise, I want the maximum.
var a = this.getField("Field1");
var b = this.getField("Field2");
var c = this.getField("Field3");
if (c==="") {
Math.min(a,b);
} else {
Math.max(a,b);
}
When I put that in, it gives me 0. For reference, Field1 = 7, Field2 = 9, and Field3 is blank on my form. So I'd be hoping the calculation would show 7, and would change to a 9, if I put a "1" in Field3.
I know what I'm missing has got to be simple or an inherent misunderstanding of javascirpt, but I can't for the life of me figure it out.

