Hi this is my first post, I hope someone can help.
I am using Acrobat 8 Pro.
I have a form with 4 fields:
Item
No of Units
Unit Cost
Amount
The field 'Item' is a drop down menu with 2 options: Showerheads & Toilets.
In layman terms this is what I want to achieve:
If the item selected is a Showerhead and its Unit Cost is greater than or equal to $60 then the Amount equals $30 x No of Units.
Else If the item selected is a Showerhead and its Unit Cost is less than $60 then the Amount equals (Unit Cost/2) x No of Units.
Else If the item selected is Toilets and its Unit Cost is greater than or equal to $300 then the Amount equals $150 x No of Units.
Else If the item selected is Toilets and its Unit Cost is greater than or equal to $300 then the Amount equals (Unit Cost/2) x No of Units.
At the moment to do this I have a Custom Calculation script on the 'Amount' field which looks like this:
var units1 = this.getField("units1").value
var unitCost = this.getField("Unitcost1").value
var Item1 = this.getField("Item1").value
var Amount1 = this.getField("Amount1")
if (Item1 = "Showerheads" && unitCost > "59")
{Amount1.value = "30" * units1}
else if (Item1 = "Showerheads" && unitCost < "60")
{Amount1.value = (unitCost / 2) * units1}
else if (Item1 = "Toilets" && unitCost > "299")
{Amount1.value = "150" * units1}
else if (Item1 = "Toilets" && unitCost < "300")
{Amount1.value = (unitCost / 2) * units1}
This is kind of working but seems to not refresh itself when the Item changes even though I have Commit Immediately ticked on for the 'Item' field.
I have 8 lines that I need to do this for, so if anyone has any ideas at all I would be forever grateful.
thanks in advance.
For example:
if (Item1 = "Showerheads" && unitCost > 59)
{
event.value = 30 * units1
}
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script