Dynamically populate dialog field | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by adilyataim

Hi @pleben , similar functionality is implemented in AEM Core Components - Image. Maybe you can reuse it or copy to you custom implementation?

Here is the git repository link - https://github.com/adobe/aem-core-wcm-components/tree/main/content/src/content/jcr_root/apps/core/wcm/components/image.

3 replies

Tethich
Community Advisor
Community Advisor
November 14, 2024

Hi @pleben 

 

You will need to add a custom js to the component, that reads the path of the added image, gets its resource, reads the text and writes in the dialog.

 

This is how you can add that custom clientlib to your component: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-add-a-js-file-to-a-particular-component-dialog-box/m-p/447174

 

In your js you can make an Ajax call to a custom servlet of yours, pass on the image path. The servlet will do the lookup for the text and return it to your js. The js will find the dialog field and write the text into it.

muskaanchandwani
Adobe Employee
Adobe Employee
November 14, 2024

You can fetch the asset’s alt text Metadata from DAM (for Example, using Query Builder) and then populate the alt text in the dialog field using JS

adilyataimAccepted solution
Level 2
November 15, 2024

Hi @pleben , similar functionality is implemented in AEM Core Components - Image. Maybe you can reuse it or copy to you custom implementation?

Here is the git repository link - https://github.com/adobe/aem-core-wcm-components/tree/main/content/src/content/jcr_root/apps/core/wcm/components/image.