Expand my Community achievements bar.

SOLVED

AEM cloud component injection issue

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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/examp...

 



Arun Patidar

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

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/examp...

 



Arun Patidar

Avatar

Level 2

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

Avatar

Level 5

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