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

Trying to configure two additional fields for tags in page properties

Avatar

Level 3

Hello,

 

I have a requirement to add two additional tag fields in page properties below original tags field.(i am using cq/gui/components/coral/common/form/tagfield). As you can see from the picture there are two additional fields, Luka tags and Marko tags. They are both mandatory and both have their defined namespaces(Luka namespace and Marko namespace). 

The problems i am encountering are as follows:

1. When i save tag that was manually entered  or selected from a tag from a specific namespace, it saves the tag under "default" namespace but i want it to save the tag under  "Luka namespace" if the tag was entered in "Luka tags" field. If the tag is entered in "Marko tags" then i want it saved under "Marko namespace". Is there a way to do this using properties in CRXDE? If not, how would i achieve this?

2. The other problem i'm having is that if you look at the picture, every field that is related to tags has the same tags list. I want every tag field to have its own taglist depending on where the tag was created. For example, if the tag was created using "Marko tags" field than i would like to display that particular tag to the taglist that is below "Marko tags" field. The current behaviour is that whenever i add  tags and click save&done, the next time i open page properties, every taglist under every tags field is the same(as showed in picture). How can i create separate tag list for every tags fields?

 

showcase.PNG

 

 

Any help is greatly appreciated.

Thanks in advance,

Luka

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

I feel those tag fields are part of your page component [we used to call it project specific base page component].

If we take a look at CRXDE to understand the details about those tag field then we will get similar kind of details as shown below -

 

DEBAL_DAS_3-1648131221600.png

 

I have created 3 separate tag fields to replicate your requirement as shown below -

DEBAL_DAS_1-1648130791378.png

 

Here , we must have unique value for property: name for each tag fields as shown below -

DEBAL_DAS_2-1648130875366.png

DEBAL_DAS_4-1648131356381.png

I feel you are having same value at property called: name for each tag field. That's why you are facing 1st problem.

 

To address the 2nd issue , you could fix the problem using rootPath with different taglist value as shown below -

DEBAL_DAS_5-1648131580526.pngDEBAL_DAS_6-1648131630756.pngDEBAL_DAS_7-1648131667486.png

Because of the different rootPath value finally I am able to display different set of tags for each tag field -

DEBAL_DAS_8-1648131755161.png

 

Hope this will help.

View solution in original post

8 Replies

Avatar

Community Advisor

Hi @luka2 

 

1. I'm not sure whether I understood the question correctly but I have two namespaces and two tag fields (the default one and custom one which I created). When i author a tag in each tagfield from each namespace and save the properties, i can see them being saved correctly on the page.

 

2. I think the issue here is for all the three tag fields the 'name' property seems to be the same. For the default/OOTB tag field, the 'name' usually will be 'cq:tags'. Please provide different name property for 'Luka tags' and 'Marko tags'. The name can be anything like lukeTags, markoTags etc. Please do this change and check whether it resolves your first issue as well.

 

Do let me know if this resolved your query.

 

Thanks

Avatar

Level 3

Hello @JeevanRaj,

Thank you very much for your answer.

What you said does solve my second issue(because name properties were the same) but the issue number one still persists, for example when i want to save the "savedtag" (like in the picture below)showcase4.PNG

Then i am expecting for that tag to get saved in AEM tags>Luka tags

showcase9PNG.PNG

My namespace folder Luka tags stays empty.

Avatar

Correct answer by
Employee Advisor

I feel those tag fields are part of your page component [we used to call it project specific base page component].

If we take a look at CRXDE to understand the details about those tag field then we will get similar kind of details as shown below -

 

DEBAL_DAS_3-1648131221600.png

 

I have created 3 separate tag fields to replicate your requirement as shown below -

DEBAL_DAS_1-1648130791378.png

 

Here , we must have unique value for property: name for each tag fields as shown below -

DEBAL_DAS_2-1648130875366.png

DEBAL_DAS_4-1648131356381.png

I feel you are having same value at property called: name for each tag field. That's why you are facing 1st problem.

 

To address the 2nd issue , you could fix the problem using rootPath with different taglist value as shown below -

DEBAL_DAS_5-1648131580526.pngDEBAL_DAS_6-1648131630756.pngDEBAL_DAS_7-1648131667486.png

Because of the different rootPath value finally I am able to display different set of tags for each tag field -

DEBAL_DAS_8-1648131755161.png

 

Hope this will help.

Avatar

Level 3

Hello @DEBAL_DAS,

I really appreciate your detailed answer. It has helped me gain more understanding about this issue.

The second problem is resolved but the first problem remains tho.

For example when i want to save the "savedtag" (like in the picture below)

showcase4.PNG

Then i am expecting for that tag to get saved in AEM tags>Luka tags

showcase9PNG.PNG

My namespace folder Luka tags stays empty.

 

Avatar

Employee Advisor

Understood your first problem. It won't get saved/persisted there ideally. Those tag list will get saved at jcr:content node of your test-page as shown below -

 

DEBAL_DAS_0-1648135361657.png

 

Could you please share screenshot of your page property dialog fields and tag structure like the below one -

DEBAL_DAS_1-1648135660803.png

 

 

Avatar

Level 3

Got it. Thanks for your help! So i guess its a custom solution for that first problem.

Avatar

Employee Advisor

Before jump to the custom solution , I would like to know the path from where you have browsed the savedtag as shown below -

 Why do you want to save these tags in AEM tags>Luka tags while authoring from business perspective? 

Avatar

Level 3

I misunderstood that requirement actually, i got it cleared today. There isnt any need for author to manually enter tags at all, he will just choose from the namespace of predefined tags and add them to the page.

Thank you for you help!