Skip to main content
Level 2
January 5, 2024
Solved

Multiple rootpath in TagField touch UI

Hi All,

Since TagPicker is deprecated from AEM 6.3. I want to migrate to TagField touch ui. rootpath property is a string so can give one specific namespace path (eg:/content/cq:tags/forum). I have a requirement to list multiple namespaces(rootpath) in tagfield touch ui dialog.

rootpath = "/content/cq:tags" - list all namespaces in cq:tags folder

rootpath = "/content/cq:tags/forum" - (single namespaces) list the children of forum namespace

Requirement: Tagfield dailog columnview should populate the tags from "/content/cq:tags/forum", "/content/cq:tags/namespace1", "/content/cq:tags/namespace2", "/content/cq:tags/namespace3"
Need to list more than one namespaces and list set of namespaces in each tagfield dialog. How to achieve this?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Kamal_Kishor
Kamal_KishorAccepted solution
Community Advisor
January 11, 2024

@jerald_rolance : As it has been highlighted, rootPath allows a string value, meaning you can specify one value.
I think that leaves you with no option but to think of alternatives. What I can think of are:

  1. If possible, structure your tags in such a way that they are under a common parent and specify that parent in rootPath property. For eg /content/cq:tags/ParentNamespace. Other tags then would come like /content/cq:tags/ParentNamespace/namespace1, /content/cq:tags/ParentNamespace/namespace2 etc.
    This would also allow you to have new tags in future to appear automatically if they are created under ParentNamespace.
  2. Create 4 tag fields and specify rootPath for each field like- /content/cq:tags/namespace1, /content/cq:tags/namespace2. This is more restricted as it does not have the flexibility to automatically make available new tag namespaces from different hierarchy.

You can decide which approach suits more to your requirements.
Hope this helps.

thanks.

15 replies

Madhur-Madan
Community Advisor
Community Advisor
January 5, 2024

Hi @jerald_rolance 
I did not understand you question properly. If you have issue related to selection of multiple tags fields please check below for the reference and it is working.
You need to set a Boolean property multiple as true.

 

 

 

Field view in Dialog

 

 

Thank You.

Translate
Level 2
January 5, 2024

Hi @madhur-madan 

I want to have multiple rootpath.
Tagfield dailog columnview should populate the tags from

["/content/cq:tags/forum", "/content/cq:tags/namespace1", "/content/cq:tags/namespace2", "/content/cq:tags/namespace3"]

I'm not able to achieve this because rootpath is a String, couldn't provide multiple values.

Translate
Raja_Reddy
Community Advisor
Community Advisor
January 5, 2024

Hi @jerald_rolance 

Yes you can use root path for Tag picker field. Please refer below URL: 

https://www.adobe.io/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite...

Thanks.

 
Translate
Level 2
January 5, 2024

Hi @raja_reddy 

I want to have multiple rootpath.
Tagfield dailog columnview should populate the tags from

["/content/cq:tags/forum", "/content/cq:tags/namespace1", "/content/cq:tags/namespace2", "/content/cq:tags/namespace3"]

I'm not able to achieve this because rootpath is a String, couldn't provide multiple values.

Translate
Level 4
January 5, 2024

Hi Jerald,

 

In the tag field you can select multiple tags by adding a property multiple="{Boolean}true" or can define the root path like below.

 

<tags

         jcr:primaryType="nt:unstructured"

sling:resourceType="cq/gui/components/coral/common/form/tagfield"

          fieldLabel="Select Tags"

          multiple="{Boolean}true"

rootPath="/content/cq:tags/geography"

          name="./tag"/>

 

If you want to have multiple root path options apart from the default one then you can add a dropdown field in the dialog with the root paths as options and use javascript to use that dropdown field value as the root path value in the tag field.

 

Hope its clear.

 

Thanks,

Sweta

Translate
Level 2
January 5, 2024

Hi @swetab 

Yes, I want to have multiple rootpath. 
Example: 

["/content/cq:tags/forum", "/content/cq:tags/namespace1", "/content/cq:tags/namespace2", "/content/cq:tags/namespace3"]

Need to list more than one namespaces and list set of namespaces in each tagfield dialog. 

I'm not able to achieve this because rootpath accpets one String value.

Translate
arunpatidar
Community Advisor
Community Advisor
January 5, 2024

Hi @jerald_rolance 
I think if it is not possible to have more than one namespace then you have to use  /content/cq:tags as root, which will cover all the root and upon submit or selection, you may need to write a custom validation check for those 2 namespaces.

Translate
Arun Patidar
arunpatidar
Community Advisor
Community Advisor
January 12, 2024

Here is the example

 

Translate
Arun Patidar
prakashvb
Level 2
January 7, 2024

@jerald_rolance You can't store multiple values in root path see below error

 

You can add validation on rootpath selection let me know if it helps

 

Translate
Level 2
January 9, 2024

Yes, need to write custom validation from rootpath. Will work on the custom validation.

Translate
prakashvb
Level 2
January 9, 2024

Option1 - you can use extraclientlibs category  dam.gui.coral.metadataeditor when ever you open metadata property JS will be trigger, on that JS you can add logic to check paths as per your need or not or you can give an error on metadata page

 

 

 

Translate
kautuk_sahni
Level 9
January 8, 2024

@jerald_rolance Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Translate
Kautuk Sahni
Level 2
January 9, 2024

@kautuk_sahni Still didn't get expected information from suggestions. Need more suggestion from community.

Translate
Kamal_Kishor
Community Advisor
Kamal_KishorCommunity AdvisorAccepted solution
Community Advisor
January 11, 2024

@jerald_rolance : As it has been highlighted, rootPath allows a string value, meaning you can specify one value.
I think that leaves you with no option but to think of alternatives. What I can think of are:

  1. If possible, structure your tags in such a way that they are under a common parent and specify that parent in rootPath property. For eg /content/cq:tags/ParentNamespace. Other tags then would come like /content/cq:tags/ParentNamespace/namespace1, /content/cq:tags/ParentNamespace/namespace2 etc.
    This would also allow you to have new tags in future to appear automatically if they are created under ParentNamespace.
  2. Create 4 tag fields and specify rootPath for each field like- /content/cq:tags/namespace1, /content/cq:tags/namespace2. This is more restricted as it does not have the flexibility to automatically make available new tag namespaces from different hierarchy.

You can decide which approach suits more to your requirements.
Hope this helps.

thanks.

Translate