Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Selecting text in a field


Level 4

Good morning everyone

I'm playing around with a textfield today where I want to have some default text showing by default and when I go into the textfield box, the text would all be selected by default so that the user as an easy time removing it from there.

Right now, I add my values to the object.default ="please choose one". That works ok, now how can I have the text selected when user puts the focus in that textbox? I cant seem to find anything that can do that.

Does anyone have an idea if that's doable or not?

thank you so much again.


2 Replies


Level 10

Hi there,

there is an easy way to do this without having to select/deleting the text in the textfield

it is called ghost text, it is simply a display pattern for fields when they equal a null value..

just go in that textfield you are talking about, in the Object properties / Field tab click on the Pattern button..

once in the Pattern dialog box, make sure you are in the display tab,

then under Pattern, just write in the textbox : null{'Please choose one'}

This should do the trick

Hope this help!


Level 4

Wow, that did the trick, thank you so much Magus