Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

AEMaaCS : dialog customization to support autofill of alt text from meta data description

Avatar

Level 5

Hi Experts,

 

I have pathfield with picker= /mnt/overlay/dam/cfm/admin/content/v2/associated-content/assetpicker.html?root=/content/dam&mode=single&filter=nosystem for selecting path for image.

 

We have Alt Text field as well for the image, so requirment is to auto fill alt text field with meta description of the selected image. something similar already exists in OOTB image cmp but not able to reuse it as our component dialog structure involves multiple tabs with multiple pathfields selectors in each tab.

 

can you please give some direction here.

 

Thanks

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Make an ajax request to assets metadata node on change to get metadata 

 

$('pathfield-selector').on('change', function(){

$.get(assetsPath + /metadata.1.json, function( data ) {
//set descript inout from dc:description
}

})



Arun Patidar

View solution in original post

6 Replies

Avatar

Correct answer by
Community Advisor

Make an ajax request to assets metadata node on change to get metadata 

 

$('pathfield-selector').on('change', function(){

$.get(assetsPath + /metadata.1.json, function( data ) {
//set descript inout from dc:description
}

})



Arun Patidar

Avatar

Level 5

Thanks for the reply @arunpatidar 

but It is not working for pathfield.

on change function is not working for pathfiled but it works for normal text field .

Becuase in normal text field , input tag has value attribute but for pathfiled .

Input is not having any vlaue tag , I can see the value is there in down below inside coral-taglist.

like below:

<coral-taglist>

  <coral-tag>

    <coral-tag-label></coral-tag-label>

    <input type="hidden" handle="input" name="./asset" value="xyz">

 </coral-tag>

</coral-taglist>

  

 

Avatar

Community Advisor

Why are you using tag fields? instead of normal input field?

You setup pathfield as multi-select, change it to 1.



Arun Patidar

Avatar

Level 5

@arunpatidar 

not understanding , I am not using any tag fields, 

I am just using pathfiled with pickerSrc 

and how to set up pathfiled as multi-select and change it to 1?

I can see multiple boolean proeprty for pathfield.

Avatar

Community Advisor

If multiple boolean property is not set then pathfield will be single.

Try with below code

$('.coral-Form-field.mycustomclass').on("change", function(){
    console.log('Hello');
})


Arun Patidar