Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Can't add child components to containers

Avatar

Level 2

I'm trying to use the AEM core form container, but when I add it to a page, there is no ability to add child elements (there is no "Drag Components Here" box).  When I click the + sign on the component, it only adds the component I choose as a sibling, not a child of the container. Here is the .content.xml:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Component"
cq:isContainer="{Boolean}true"
jcr:title="Form Container"
jcr:description="Container for other form components"
sling:resourceSuperType="core/wcm/components/form/container/v2/container"
componentGroup="mygroup"
/>

Shouldn't the isContainer property allow me to add child components? I have my template policy and the container component policies set to allow certain components. 

7 Replies

Avatar

Community Advisor

@dms879090 

cq:isContainer Boolean Indicates whether the component is a container component and therefore can contain other components such as a paragraph system.

You could probably create a subgroup and add it to the policies. cq:isContainer  would make a tree structure for the content tree.

Avatar

Level 2

If I use the component as I currently have it, I am able to add it to a we.retail hero page and it works as expected (it displays "Drag Components Here" in the editor and I can add child components). I updated the policy for the page, layout container that I add my component to, and the component itself to make sure it was an allowed component and had allowed components for children, still no luck.

 

But when I add the component to one of my custom pages, it doesn't allow me to add child components and does not show "Drag Components Here".  The same is true if I try to use a we.retail form container component on my custom page.

Avatar

Employee Advisor

I would suggest you follow the we.retail form container component and here is the component's path: /apps/weretail/components/form/container.

 

If you take a look at /apps/weretail/components/form/container/new and follow the similar approach, then you will be to add components within Form container.

 

Please give a try.

Avatar

Level 2

If I use the component as I currently have it, I am able to add it to a we.retail hero page and it works as expected (it displays "Drag Components Here" in the editor and I can add child components). I updated the policy for the page, layout container that I add my component to, and the component itself to make sure it was an allowed component and had allowed components for children, still no luck.

 

But when I add the component to one of my custom pages, it doesn't allow me to add child components and does not show "Drag Components Here".  The same is true if I try to use a we.retail form container component on my custom page.

Avatar

Employee Advisor

Are you seeing any error in browser console while using your application specific page?

 

Please create a new page with your application specific template and don't add any other component on that page.

Then add your form container component and check whether it allows you to add any component.

Avatar

Level 2

When I create a new page and before adding any components I have no errors, but I have the following warning in my dev console:

 

 DevTools failed to load source map: Could not load content for http://localhost:4502/etc.clientlibs/cq/personalization/clientlib/underscore-umd.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

 

When I then add my form container component, I still cannot add child components

 

Avatar

Level 2

Something I hadn’t considered or mentioned is that my front end uses Angular. Does using angular instead of HTL affect the ability to add components?