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

Rounding Number in numeric Field

koenigma
Registered: Jan 23 2008
Posts: 45
Answered

I have a numeric field named Airfare and would like that it rounds the user input using the .5 rule (i.e 834.45 = 834.00 or 834.5 = 835.00)

The Code shown below I have tried placing in exit, change and validate but nothing happens the number does round up or down.

round(Airfare_1, "abc")

Any help with what I am doing wrong wold be appricated

Kind Regards
Martin

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Round is FormCalc (not JavaScript) and to be put into the calculate event.

Round(Airfare_1, 2)

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

koenigma
Registered: Jan 23 2008
Posts: 45
radzmar wrote:
Round is FormCalc (not JavaScript) and to be put into the calculate event.Round(Airfare_1, 2)
The posted reply does not solve the problem, since if it placed in calculate the user can not enter a number in the field. When trying to enter you get the error message.

So my orignal question remains, how to round a number entered into a numeric field?

Kind Regards
Martin
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Ok Martin,

use this FormCalc script in the exit event of your nummeric field.

$.rawValue = Round($.rawValue)

Also set the dataformat to "floating point" and view settings to "num{zzzzzzzz9.99}".
I testet it an it works in that way you want it to.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

koenigma
Registered: Jan 23 2008
Posts: 45
Just want to say thanks for your help, I realize now where my mistake was I was not placeing "$.rawValue =" before the Round($.rawValue.

Agin thanks.

Kind Regrads
Martin