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

Drop down if else expression

benz862
Registered: Mar 5 2008
Posts: 10
Answered

I have a drop down list that is NOT populated via XML, so what I have it doing now is populating a DiscountPercentage numeric box with a set number depending who's name has been selected.

What I would like to happen is limit this DiscountPercentage box to a set number based on the person who's name has been selected from the drop down box.

So...

RepName = Drop down box
DiscountPercentage = The amount of discount applied to a price in a table

In a nutshell, if you were to select "Jane Doe" as a person from RepName, she would be entitled to give a 10% discount or less. If she was to put for example the number 15 in DiscountPercentage, the DiscountPercentage would look at who's name has been selected from RepName, and adjust the DiscountPercentage back to 10 vice the 15 she put in the box.

I know this must involve an if else statement, but I can't seem to get this to work. BTW, I only have around 12 reps or so, so it shouldn't be too difficult to do. Thank you.

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The script for limiting the actual percentage should be in the validation script for the percentage field.

Set the language to JavaScript.

It should look something like this. The "MaxPercent" Field is the output from the dropdown list. You're field names will be different .

if(this.rawValue > MaxPercent.rawValue)
this.rawValue = MaxPercent.rawValue;

true;

The last "true" statement is necessary to keep the validate funtion from throwing an error message at the user.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

benz862
Registered: Mar 5 2008
Posts: 10
What would people do without the genius that this forum provides? Thanks so much for your response, it worked perfectly.

Glenn