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

Percentages based on dropdownlist selection

KDCS
Registered: Sep 30 2009
Posts: 36
Answered

I have the script below that works for the most part. The form calculates a price and takes a discount based on a drop down list selection. But I want to add limits to the discounts based on your total purchase. You would only get the 5% discount if your total purchase is between $200 and $499 and you would only get a 50% discount if your total purchase was between $500 and $999... Is there a way to add this into the script below or do I need a total different script?

Any help would be greatly appreciated. Thank you.

if (DropDownList1 == "A") then
DecimalField1.rawValue = Price1.rawValue * 0.95 ;5% discount

elseif (DropDownList1 == "B") then
DecimalField1.rawValue = Price1.rawValue * 0.50 ;50% discount

elseif (DropDownList1 == "C") then
DecimalField1.rawValue = Price1.rawValue * 0.25 ;25% discount

else
DecimalField1.rawValue = Price1.rawValue ;no discount

endif

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

the solution is simalar to the answer explained in thread:
http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=22283

Put this code into the calculate event of you final price field.
var MyDiscount = DropDownList1.rawValuevar MyPrice = Price.rawValue if (MyDiscount == "A" and MyPrice >= "200" and MyPrice <=499 ) then$.rawValue = MyPrice * 0.95 ;5% discount elseif (MyDiscount == "B" and MyPrice >= "500" and MyPrice <=999) then$.rawValue = MyPrice * 0.50 ;50% discount else$.rawValue = MyPrice ;no discountendif

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

KDCS
Registered: Sep 30 2009
Posts: 36
Execellent. Thank you. I am new to LCD and scripting. So your help is greatly appreciated.

Thanks again.