Hello Team,
I want to get the tags(cq:tags) of the asset that I choose in the dialog. First, I have a textfield where I can select the required asset from DAM. Just below that, I want to show the tags associated to it in the dialog. Could you please help me with this ?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
I have a textfield where I can select the required asset from DAM
I guess you are referring to pathfield not textfield. Now need to do this with listeners. below is the code you can use. It works for me
Make sure you have two field with
1.Pathfield : where you will select path
2.Tag input field with name ./tags
Here is what dialogs looks like
Here is the output
Here is js Listener code you need to use
function(d) { path = this.value+"/jcr:content/metadata.json"; var x = CQ.shared.HTTP.eval(path); var tags = []; tags = x['cq:tags']; dialog = this.findParentByType('dialog'); field = dialog.getField('./tags'); field.setValue(tags); }
Let me know if you face any issue.
Views
Replies
Total Likes
Hi,
I have a textfield where I can select the required asset from DAM
I guess you are referring to pathfield not textfield. Now need to do this with listeners. below is the code you can use. It works for me
Make sure you have two field with
1.Pathfield : where you will select path
2.Tag input field with name ./tags
Here is what dialogs looks like
Here is the output
Here is js Listener code you need to use
function(d) { path = this.value+"/jcr:content/metadata.json"; var x = CQ.shared.HTTP.eval(path); var tags = []; tags = x['cq:tags']; dialog = this.findParentByType('dialog'); field = dialog.getField('./tags'); field.setValue(tags); }
Let me know if you face any issue.
Views
Replies
Total Likes
Many thanks Edubey. You saved a ton of my time.
Views
Replies
Total Likes
Hi,
I have tried to the same thing in my component but its not working for me.
Plz find below the screen print:
so kindly suggest me what is the issue in my structure or what property i have missed.
and plz provide me the complete logic also.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies