Acrobat Javascript assistance for comparing multiple fields and providing output
This one is a doozy for my non-programming head. I have tried to at least define the syntax for a javascript but I just can't wrap my head around the code for the following:
- I have 3 textboxes: "Total_Equipped_Move", "Total_Packed_Move" and "Total_Equipped_Packed".
- "Total_Equipped_Move" has a value calculated from other text boxes.
- "Total_Packed_Move" has a value calculated from other text boxes.
- "Total_Equipped_Packed" has a value calculated from other text boxes.
I would like the "MoveRate" textbox to display the lesser value between "Total_Equipped_Move" and "Total_Packed_Move" unless the sum of "Total_Equipped_Packed" is 16 or greater, then output "0".
I've taken a stab at it but my output is "TEM" instead of the value of "TEM", which also means that neither follow on statements are being calculated:
var TEM = Number(this.getField("Total_Equipped_Move").valueAsString);
var TPM = Number(this.getField("Total_Packed_Move").valueAsString);
var TEP = Number(this.getField("Total_Equipped_Packed").valueAsString);
if (TEM < TPM) {
event.value = "TEM";
}
else if (TEM > TPM) {
event.value = "TPM";
}
else if (TEP > 16) {
event.value = "0";
}
Assistance would be greatly appreciated. Thanks in advance!
