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

Percents

tgaspard
Registered: Aug 17 2011
Posts: 15

I set up a field on a form for users to enter a discount %.
The plan was that they would type "25", it would display as "25%" and then another field would calculate the $ amount of the discount.
 
However, the % field isn't working as I anticipated.
 
If I type in "25", it displays "2,500%"
The $ amt field calculation works fine...its just the display that isn't doing what I want it to.
 
I've tried playing with the patterns and, no matter what I do, I get the same result.

-tina

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
The percentage value is the decimal value multiplied by 100. There are a couple of good reasons for this. First if the value is computed, then one only needs to perform the division. And to apply the percentage, then a simple multiplication of the necessary field is all that is needed. There is no additional computation step needed to arrive at the correct computed values. Since the field can be validated, you can trap the erroneous value and explain how to enter the value as a decimal value.

Excel sort of works the same way and uses an assumed decimal place after the last digit if none is entered.

If you want to write all of the necessary code for the adjustment, be my guest.

George Kaiser

tgaspard
Registered: Aug 17 2011
Posts: 15
Maybe I wasn't clear...
I am not having an issue with the calculation. I'm having an issue with the way the % is displaying.

When a user enters "25" I want it to show up at "25%" NOT "2500%"
I get what you're saying about the decimal value xs 100...and it appears that is what its doing, but I'm not entering a decimal value and I don't want my users to, either.

I'm also not keen on writing a bunch of code, or being fussed at for that matter. I'd just like some help figuring out what setting I have wrong so that this discount field works the way it seems it should.

I've spent the better part of a day searching the web, this forum, and the help in LiveCycle for direction and come up empty.

-tina

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Then have them enter the decimal value of 25% which is 0.25.

And you will probably need to add some instruction text about how to do the entry and possibly a simple validation script.

For LiveCycle Designer, enable the error message and enter the necessary message:

$.rawValue > 0 and $.rawValue < 1.00For Acrobat the custom validation:

if(event.value < 0 & event.value > 1.00) {
event.rc = false;
app.alert("Enter the percentage as a decimal value between 0 and 1.00", 1, 0);
}

George Kaiser