Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Multiple rootpath in TagField touch UI

Avatar

Level 2

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?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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.

View solution in original post

15 Replies

Avatar

Community Advisor

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.

 

MadhurMadan_0-1704435482832.png

 

 

Field view in Dialog

MadhurMadan_1-1704435482831.png

 

 

Thank You.

Avatar

Level 2

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.

Avatar

Level 2

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.

Avatar

Level 4

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

Avatar

Level 2

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.

Avatar

Community Advisor

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.



Arun Patidar

Avatar

Level 2

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

prakashvb_0-1704602957905.png

 

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

 

Avatar

Level 2

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

Avatar

Level 2

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

 

prakashvb_0-1704784037995.png

prakashvb_1-1704784159456.pngprakashvb_2-1704784239237.png

 

 

Avatar

Administrator

@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.



Kautuk Sahni

Avatar

Level 2

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

Avatar

Correct answer by
Community Advisor

@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.