Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Use javascript to create a display pattern

Avatar

Level 4


I have a text field that is subject to parameters regarding display (color, font, posture) in the initialize, enter, and exit event for the field. With this script, using the display patterns on the object palette apparently will not work because of the code. Seems like the logical solution would be to add a pattern definition in the exit event. However, I do not know the syntax for this. I am looking to apply a US currency pattern such as num{($z,zzz,zz9.99)} to the field. I have tried things like this.font.pattern = num{($z,zzz,zz9.99)}; but that does not seem to work.

Can anyone suggest the right code?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi there,

I think what you are looking for is the following:

this.format.picture.value = "num{($z,zz9.99)}";

Hope this help.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi there,

I think what you are looking for is the following:

this.format.picture.value = "num{($z,zz9.99)}";

Hope this help.

Avatar

Level 4

I used your suggestion as follows:

this.format.picture.value = "num{($z,zzz,zz9.99)}";

in the enter event and it worked like a charm.

Thanks.