Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How To Allow User To Enter "$" In A Number Field

Avatar

Level 1

I have a form that includes various numeric fields in which the user should enter dollar values. It works fine if the user enters a number WITHOUT a dollar sign. Suppose the user enters "1234", the field will display "$1,234.00", which is exactly what I want. However, if the user decides to change the value, clicks on the field, and replaces the "00" with "56" then when they leave the field it will display "$0.00". I've figured out this is because they left the dollar sign in the field when editing.

So, how can I fix the validation or other settings so that someone could enter "$1234" and have it show "$1,234.00" instead of "$0.00"?

Thank you!

  Mike

2 Replies

Avatar

Level 3

Hi MJD729,

Have you applied patterns on the numeric field? select pattern like $1,234.21 in Display and Edit TAB of Patterns- Numeric Field dialog box and then check.

Regards,

Ratnesh

Avatar

Level 1

Hello Ratnesh,

Yes, I have tried patterns. The one you suggested was what I had originally set. I've tried all the listed patterns including num.currency(). The behavior is always the same.

Have you had any success making this work?

Thank you,

  Mike