How to calculate using variables in javascript?
Hello, I need help trying to figure out how to create a code in a pdf from with javascript where I want to be able to, using 2 different text variables, get a narrow result and then multiply it. For example: if "name" = "john" and "sex" = "male", that set of variables gives me a value ex: "6", after that I would get another value presented in a editable field and multiply it by the result in my search.
Please check the code I came up with:
var a = this.getField("peso01").value;
var b = this.getField("uni01").value;
var c = this.getField("quant01").value;
var d = 6;
var e = 240;
var result;
switch (a) {
case '1':
a = "2KG";
break;
case '2':
b = "PAL";
break;
case '3':
b = "PACK";
if (a === "2KG" && b === "PACK") {
result = c * d;
} else if (a === "2KG" && b === "PAL") {
result = c * e;
}
break;
}I can't seem to make it work, please help me get it right.
