Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

How to get content path (asset path) in addtag listener of cq:tags in classic ui?

Avatar

Level 2

We have some validation while adding tags in asset metadata, so this validation taken care in addtags listener of cq:tags.

Now got a requirement to restrict this addtag validation for one particular content path. So while I try to get contentPath from inputField, but it always comes as null.

Please suggest how to get current content (asset) path in addtag listener of classic ui. AEM version: AEM6.2.SP1-CFP9.

addtag:

function(inputField, tag) {

console.log(inputField);  --> it has contentPath property, but has null value always

contentPath =  inputField.contentPath;

console.log(contentPath);

}

1 Accepted Solution

Avatar

Correct answer by
Level 2

Finally I found to got way to get the content path in addtag listener of tag type in asset metadata editor:

function(f) {

contentPath = f.findParentByType("asseteditor").path;

console.log(contentPath);

}

View solution in original post

1 Reply

Avatar

Correct answer by
Level 2

Finally I found to got way to get the content path in addtag listener of tag type in asset metadata editor:

function(f) {

contentPath = f.findParentByType("asseteditor").path;

console.log(contentPath);

}