AEM dialog using sling:resourceType include on the same component dialog multiple times | Community
Skip to main content
Level 2
April 20, 2022

AEM dialog using sling:resourceType include on the same component dialog multiple times

  • April 20, 2022
  • 3 replies
  • 3771 views

Hi there,

I have a very similar issue that was posted on StackOverflow (see link below), but unfortunately, I was not able to find a solution yet.
https://stackoverflow.com/questions/68459743/aem-dialog-using-slingresourcetype-include-on-the-same-component-dialog-twice 
How I can use the following in the same dialog multiple times?

<ctaLinks
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/include"
path="/apps/my_project/components/base/_ctagroup/content/items/ctaLinks"/>  

Assume i have 2 Tabs, and I want to be able to use this generic / global ctaLinks in both tabs.
But when I use (the code snippet above) multiple times in dialog .content.xml,
cta button is duplicated, so Tab 1 and Tab 2 dialog config in new component is overriding each other's value.
So whenever I change the cta value in Tab 1, it also changes the cta value in Tab 2.

Your help is greatly appreciated. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

Ravi_Pampana
Community Advisor
Community Advisor
April 21, 2022

Hi,

 

Values getting duplicated because the name field is same in both the tabs as you are including same global/ctaLinks using path. 

 

Try using sling:resourceSuperType instead of path with that you can overwrite the name property in child node and have different names in tabs

Level 2
April 21, 2022

@ravi_pampana thanks for the reply. Actually, I have tried it before as it was suggested in other similar posts. When I use sling:resourceSuperType instead of path nothing works. 

Himanshu_Jain
Community Advisor
Community Advisor
April 21, 2022

Name field needs to be unique

Himanshu Jain
Level 2
April 21, 2022

@himanshu_jain thanks for the reply. Yes, the name field needs to be unique, but I don't think I can use the name field when I use include according to the granite ui doc below. Is it ever possible? Any suggestions? https://developer.adobe.com/experience-manager/reference-materials/6-4/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/include/index.html 

DEBAL_DAS
New Member
April 22, 2022

We all are aware that because of identical value of name property(field) you are facing this issue. 

Want to understand why are you planning to provide similar set of fields in both tabs from functional point of view? 

Debal Das, Senior AEM Consultant