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

How to add placeholder text to Dropdown in Component

Avatar

Level 5

Hi Team, 
I'm creating a component with dropdown value. There I've added 2 values in dropdown from that one value is always selected. But I don't want that, I just want my dropdown empty when I add component to page. So is there a way I can add placeholder text or default value other than my original values ?? Form resource type is : granite/ui/components/coral/foundation/form/select

 

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

The property called emptyText to add placeholder text, e.g.

emptyText = "Placeholder text..."

https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/... 



Arun Patidar

View solution in original post

2 Replies

Avatar

Employee Advisor

Hi @Tessa_learner1 ,

 

You can add a "default" option (placeholder text) and set the selected property for it, this can work as a placeholder when the dropdown is displayed.

 

Please check this thread for implementation details.

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-6-5-default-value-setu... 

 

Hope this helps!

 

Regards,

Nitesh

Avatar

Correct answer by
Community Advisor

Hi,

The property called emptyText to add placeholder text, e.g.

emptyText = "Placeholder text..."

https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/... 



Arun Patidar