I have a requirement where author can provide the alt text on dialog field or when the checkbox is clicked, alt text will be the image title.
I am able to set everything fine, but i also want to show the dropped image title on the dialog field. Is there any way to show the image title on dialog field other than making a ajax call through JS (I cannot do it as it is blocked).
Also whenever different image is dragged and dropped, I have to show its corresponding image title as alt text.
Hi @santhoshd ,
Image core component is doing the same thing. either you can create a proxy component of it or take it as reference for your custom component.
See the below image component user guide
If you want to create proxy of it see the below article:
Hope this will help.
Hi @Umesh_Thakur ,
Thanks for your reply.
We have a proxy component and I tried that as well. But it is not working. Under my custom component I am just saving the image path as property and from the sling model i am returing the assettitle (Which is working fine).
Whenever an image is dragged and dropped, under a textfield in dialog i have to show its Title (To notify author the image title that will be used). If second image is dropped, textfield has to update and show the title of second image.
I also tried setting value of the textfield as below but it is giving nullpointer exception.
then here you will have to go with front-end logic as it is done for image core component.
there is one image.js in that file at line# 123 one ajax call is being made to auhtored asset meta to get all the date in json then from there it is setting to the dialog filed on the fly.
below is the path of the js file
if you have done same like that and still it is not working then try to check the response on calling .json of the image like below is the url for /content/dam/core-components-examples/library/sample-assets/mountain-range.jpg from my local and see if dc:title is there or not. if not the try with other image where you have this property.
hope this will help.