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.
SOLVED

Pls. suggest me a good Pattern for a decimal field

Avatar

Level 8

Hello

Pls. help me by suggesting a good pattern for a decimal field of amount value, my issue is as below

The lengths are as below,

100.jpg

I specified the Pattern for this field as below (its as --> null{}|zero{}|num{($z9,999.99)}|num.decimal{}), pls. note i did't put any Pattern in EDIT tab

200.jpg

1) But, when user entered the vaue am getting as on the form,

300.jpg

But i want the above as just either $1.10 or $1.1

2) also, am getting as below for another value,

400.jpg

But i want the above as just either $0.60 or $0.6

3) another case as below,

600.jpg

But, i want the above looks like as just $12,345 (if possible, if its not possible thats OK)

4) When the form is rendered on the browser am seeing the field as below,

700.jpg

But, once user put the cursor/clickedon the field the zero is defaulting as below,

800.jpg

but, i don't want to default the zero as above, just having blank is wanting (if its possible then thats nice, if its not possible thats OK), actually, i have another decimal field as below with the Pattern, (pls. note this field has also a EDIT ppatern as well)

900.jpg

The EDIT pattern is as below,

1100.jpg

so, this field appearence on the form rendering is as below,

1000.jpg

Once the user put the cursor / clikced the field the fiel looks like below

500.jpg

having this is fine for me instead of defaulting zero as described in issue # 4

Pls. suggest me a good pattern to meet all my above 4 issues

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 7

So use Viewer's system locale and just put the pattern as:

num.currency{zz,zz9.zz}

View solution in original post

4 Replies

Avatar

Level 7

The number pattern you want is num{$zz,zz9.zz}

Avatar

Former Community Member

It seems you have too many things going on in the data validation pattern, clear that out, then select from the "select type" field $1,234.21. That should fix it and must be done on all fields.

I also use this pattern on a regular basis: num{($z,zzz,zz9.99)}

You can cut and paste it as well.

Avatar

Level 8

Thank you.

But, as am using 'VIEWER'S SYSTEM LOCALE' system is not giving the options like $1,234 as shown in my 1st pic.

If i use 'DEFAULT LOCALE' then, i am seeing these options of $1,234.......but, my form is also meant for EUROPE, where in the $ is not currency, hence i started using the VIEWERS SYSTEM LOCALE

Thank you

Avatar

Correct answer by
Level 7

So use Viewer's system locale and just put the pattern as:

num.currency{zz,zz9.zz}