Expand my Community achievements bar.

SOLVED

Dynamically populate dialog field

Avatar

Level 1

I have an image drag and drop field. Upon dragging image i want the image alternative text to be inherited from DAM and show up in the dialog field below. How to go about this? Any help appreciated

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 2

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/wc....

View solution in original post

3 Replies

Avatar

Level 5

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-...

 

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.

Avatar

Employee

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

Avatar

Correct answer by
Level 2

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/wc....