Expand my Community achievements bar.

Displaying characters in numeric field

Avatar

Level 4

HI...I'm attempting to display a "$" in a field that the user will enter a number? Once they enter the number, I want a dollar sign dispalyed in front of it.

Is that possible?  Also is there a way to add parenthesis around the number that the user will enter in a numeric field

such as (250) ?

Thanks for the help!!!

17 Replies

Avatar

Level 10

With the field selected click the Patterns button on the Object palette, you want the Display Patterns.

There are prebuilt patterns for phone numbers and currency. The phone number one is on the text field patterns though (you can use it for a numeric field too by changing "text" to "num" in the string).

You can also do it with scripting:

fieldName.format.picture.value = "num.currency{}";

or

fieldName.format.picture.value = "num{'('999')' 999-9999}";

Avatar

Level 4

Is there a way to also round the currency value so instead of $189.98 it would be $190?

Avatar

Level 10

The easiest way is probably with FormCalc - check in Help->Scripting->FormCalc User Reference->Arithmetic Functions->Round.

Avatar

Former Community Member

If you only display 3 chars it will round automatically for you

Paul

Avatar

Level 4

I have a pattern set up for a numeric field: num{($zzz,zz9)}

But I want the field to show up with parenthesis around the number like this:

(8,000)

Is that possible? What would I need to change in the pattern I currently have?

Thanks!

Avatar

Former Community Member

As I posted earlier ...put single quotes around the left and right paren.

Paul

Avatar

Level 4

If I do that, my pattern is now num{'($zzz,zz9)'}

But in field now, the pattern shows up now as ($zzz,zz9)

Any ideas?

Avatar

Former Community Member

No the pattern shoudl be:

{'('$zzz,zz9')'}

Only the parens are in quotes.

paul

Avatar

Level 4

I have that pattern on a row that can be duplicated. When I preview the .pdf, it seems like the first row has the () around the numbers, but when I add rows, the () are not always applied.

Is there a reason for this? I thought that pattern would carry through since the row is just getting duplicated.

Avatar

Level 4

Thanks, but I tried the form again outside of livecycle and it seems fine. Maybe there is a difference in the preview pdf in livecycle and actually viewing the .pdf

Livecycle also keeps crashing on me. Do you have that problem. I'll try to save a file and it says runtime error and it keeps crashing and the file gets saved at 0 KB! So all the data is lost.....?

Avatar

Former Community Member

There should be no difference in rendering a form.

No I do not have crashing issues. I use my Designer all day and it never crashes. Do you have all of the latest patches on?

Paul

Avatar

Level 4

No patches, do you have the link where to download them from?

Avatar

Former Community Member

No I download them internally .....I would start on the Adobe support site.

Paul

Avatar

Former Community Member

Hi...I'm attempting to apply numeric field format at runtime which are as follows:

1. "num{'-'$z,zzz,zz9.99 "

+ "}" format. This format should be displayed only when the entered value is negative (e.g. -500) - NOT WORKING

2. "num{'+'$z,zzz,zz9.99 " +"}" format. This should be displayed when the value is positive (e.g. 365) - WORKING

I was able to achieve this but problem lies with the point #1 - where for a negative value the output comes as positive number. Can you suggest for the above scenario.

Thanks for the help!!!