AEM cloud component injection issue | Community
Skip to main content
Level 2
August 5, 2024
Solved

AEM cloud component injection issue

  • August 5, 2024
  • 1 reply
  • 776 views

Hello, 

I am creating multiple forms which has radio button field which are common for all of them.

How can I inject a radio button component into each form container to avoid recreating the same component for every new form.

 

 

I have asked related question here but still didnt get currect solution

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/html-duplication-when-injecting-component-in-a-form-container/td-p/692986

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

Hi @margaritageg 
You need to use cq:template node to initialise component with default values/children component

example https://github.com/adobe/aem-core-wcm-components/tree/3d1b22bf30bcec37007beb2b096756465df02bcc/examples/ui.apps/src/content/jcr_root/apps/core-components-examples/components/demo

 

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
August 5, 2024
Level 2
August 5, 2024

This solution is excellent, but I have another question. When I created a container for the first time, it worked perfectly. However, when I had already created some container components, the radio buttons didn't add automatically. Should I write Groovy, or is there another solution

narendiran_ravi
Level 6
August 5, 2024

Yes you can write the groovy script as the cq:template adds the initial structure while we add the component to the page