These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

I need to make my form calculate a freight charge

ilikebinglee
Registered: Dec 11 2008
Posts: 11
Answered

This is my first time using javascript, i need to make my form calculate a freight charge, but i am reallystruggling, and this is just the first part of the equation, i then need the freight charge to be added to the final invoice cost only if a check box is selected, but that is something i should be able to work out myself, i am just having trouble getting the script i wrote to spit out the answer into the freight field so i can add it to the final cost, the offending script follows, any help would be AWESOME!!!

var Freight = this.getField("PayQTY").value;
event.value= this.getField ("Freight");

if ((PayQTY >0) && (PayQTY <3))

{
event.value = 15;
}

else if ((PayQTY >=3) && (PayQTY <=4))
{
event.value = 20;
}

else if (PayQTY >4)
{
event.value = 25;
}

My Product Information:
Acrobat Pro 9.0, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Try this:

// Custom calculation script for Freight field // Get the PayQTY field value, as a numbervar PayQTY = +getField("PayQTY").value; if ((PayQTY > 0) && (PayQTY < 3)) { event.value = 15; } else if ((PayQTY >= 3) && (PayQTY <= 4)) { event.value = 20; } else if (PayQTY > 4) { event.value = 25; }

George
ilikebinglee
Registered: Dec 11 2008
Posts: 11
You totally rock!!!