Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Dialog and decimal fields

Avatar

Level 3

I've created a dialog with AcroDialogs.

Works great, but i have a few problems.

I've got a decimal field where the decimals are comma separated.

The Dialog previews the currently filled in data from the field.

It shows the wrong value and when i continue the field is empty

When the decimal field has a value: 500,00

The dialog shows: 500,000000

When i continue, the field is empty

But when i replace the comma into a point in the dialog, it works perfect.

How can I change the points in commas and vice versa?

I also have a problem putting a date into a date field.

It previews it as it has been inputted in the dialog

1 Reply

Avatar

Level 4

I find the "numeric" designation for a field to be a distraction.  Never use it.  There is no way to control the formatting.  You're best approach is to never allow an actual "Number" type value to be placed in a field.

For example, if "mytx" is the id for a text field:

This is the correct way to put a number looking value into the field

   dialog.load({"mytx":"2.50"});

This is the wrong way to do it.

   dialog.load({"mytx":2.50});

For the real thing use "util.printf()" to format the numbers the way you'd like before they are applied to the dialog.  I typically set the field "variable" values to the correct string format before activating the dialog, and then modify the dialog "commit" function to return number values.

<

Thom Parker
The source for PDF Scripting Info
pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often
http://www.adobe.com/devnet/acrobat/javascript.html

Then most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)