Is it Possible to set the path selected in searchRoot to be the rootPath of tagSelector | Community
Skip to main content
New Participant
November 27, 2024
Solved

Is it Possible to set the path selected in searchRoot to be the rootPath of tagSelector

  • November 27, 2024
  • 2 replies
  • 542 views
      <items jcr:primaryType="nt:unstructured">
                                            <searchRoot
                                                jcr:primaryType="nt:unstructured"
                                                sling:resourceType="granite/ui/components/coral/foundation/form/pathfield"
                                                fieldDescription=""
                                                fieldLabel="Tag Path"
                                                name="./searchTagsPath"
                                                required="{Boolean}false"
                                                rootPath="/content/cq:tags"
                                                value="${not empty cqDesign.searchRoot ? cqDesign.searchRoot : ''}"/>
                                            <tagSelector
                                                jcr:primaryType="nt:unstructured"
                                                sling:resourceType="cq/gui/components/common/tagspicker"
                                                fieldDescription=""
                                                fieldLabel="Select Tags"
                                                name="./searchTags"
                                                required="{Boolean}false"
                                                rootPath=""
                                                value="${not empty cqDesign.searchRoot ? cqDesign.searchRoot : ''}"/>
                                        </items>
Best answer by PRATHYUSHA_VP

Hi @vivekna3 

 

Adding my thoughts here -

 

1. One way to achieve this is writing custom script and add the script in extraClientlibs in the dialog. Upon selection of searchRoot update tagSelector rootPath in the script.

2. Other way is changing the searchRoot as a dropdown field and select the pre-defined rootPaths from the list. Based on the selection hide/show the tagSelector rootPath using cq-dialog-show-hide property (No customization is needed in this case)

 

Hope this helps

 

Thanks

 

2 replies

gkalyan
New Participant
December 1, 2024
PRATHYUSHA_VP
PRATHYUSHA_VPAccepted solution
New Participant
November 27, 2024

Hi @vivekna3 

 

Adding my thoughts here -

 

1. One way to achieve this is writing custom script and add the script in extraClientlibs in the dialog. Upon selection of searchRoot update tagSelector rootPath in the script.

2. Other way is changing the searchRoot as a dropdown field and select the pre-defined rootPaths from the list. Based on the selection hide/show the tagSelector rootPath using cq-dialog-show-hide property (No customization is needed in this case)

 

Hope this helps

 

Thanks