Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

Avatar

Level 4

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
}

})

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
}

})

Avatar

Level 4

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.

Avatar

Level 4

@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');
})