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

Format a field as the user types

Avatar

Level 1

Hello everyone. I've been trying to find a nice way to format a field while the user is typing.

For example:
Raw input: 123456
Expected Format: 123.456

So, when the user types 1234 it should instantly change to 1.234

I've juggled a bunch of hacky workarounds such as unfocusing and re-focusing the field but this leaves the field's text selected.  Another thing I tried was to simply set the rawValue of the input to a formatted version of the text, but nothing happens (I'm guessing LiveCycle Designer dissalows fields content to be changed while they are focused)


Any ideas?

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 7

This works only when the field is exited, but you could just use a Pattern.

Click Patterns

1460925_pastedImage_0.png

Select a Pattern

1460926_pastedImage_1.png

Click OK

Type in your field

1460927_pastedImage_2.png

When your field is exited

1460928_pastedImage_3.png

View solution in original post

1 Reply

Avatar

Correct answer by
Level 7

This works only when the field is exited, but you could just use a Pattern.

Click Patterns

1460925_pastedImage_0.png

Select a Pattern

1460926_pastedImage_1.png

Click OK

Type in your field

1460927_pastedImage_2.png

When your field is exited

1460928_pastedImage_3.png