Multifield is not retaining more than one item | Community
Skip to main content
Level 2
April 15, 2025

Multifield is not retaining more than one item

  • April 15, 2025
  • 2 replies
  • 501 views

The multifield below is not retaining more than one item. The child node only stores one item in content path. Second item is saved directly on the component node itself. Need guidance in understanding error in the structure
Multifield dialog: 

<multifieldDialog jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/multifield" composite="{Boolean}true" fieldLabel="Items"> <field jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/container" name="./multifieldAssets"> <items jcr:primaryType="nt:unstructured"> jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/textfield" fieldDescription="Enter the title for the icon." fieldLabel="Title" name="./title" required="{Boolean}true"/> </items> </field> </multifieldDialog>

  

2 replies

partyush
Community Advisor
Community Advisor
April 15, 2025

Hi @zendarkke 

Can you try this 

<multifieldDialog jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/multifield" composite="{Boolean}true" fieldLabel="Items"> <field jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/container" name="./multifieldAssets"> <items jcr:primaryType="nt:unstructured"> <title jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/textfield" fieldDescription="Enter the title for the icon." fieldLabel="Title" name="./title" required="{Boolean}true"/> </items> </field> </multifieldDialog>
The multifield issue is likely due to a malformed XML structure. Use the corrected XML provided above, ensuring proper nesting of the textfield under items. 

Thanks ! 
ZendarkkeAuthor
Level 2
April 15, 2025

I made an error while copying the code. The structure you provided is the one that is in use 

partyush
Community Advisor
Community Advisor
July 11, 2025

Hi @zendarkke 

 

The in provided solution the title node is present ! where as in your query it is not present, both are not same.

here is one more example try this.

<multifieldDialog jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/multifield" composite="{Boolean}true" fieldLabel="Items"> <field jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/container" name="./multifieldAssets"> <items jcr:primaryType="nt:unstructured"> <titleNode jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/textfield" fieldDescription="Enter the title for the icon." fieldLabel="Title" name="./title" required="{Boolean}true"/> </items> </field> </multifieldDialog>

 

Thanks

SantoshSai
Community Advisor
Community Advisor
April 15, 2025

Hi @zendarkke,

Looks like, this is a classic multifield + composite=true in AEM dialogs.

Your multifield is set with composite="{Boolean}true", which means AEM is supposed to create a node per item under the component node, like:

+ your-component
  + multifieldAssets
    + item0
      - title = "Title 1"
    + item1
      - title = "Title 2"

But in your case, you're seeing:

  • One item inside multifieldAssets

  • Another field like title directly on the component node — which is incorrect.

The Problem

Your structure is almost right, but missing proper nesting inside <items>.

Specifically, you should have a container inside <items>, and within that define your form fields.

Try this

Here’s how your dialog should look:

<multifieldDialog jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/multifield" composite="{Boolean}true" fieldLabel="Items"> <field jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/container" name="./multifieldAssets"> <items jcr:primaryType="nt:unstructured"> <!-- Wrap fields in a container node --> <item jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/container"> <title jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/textfield" fieldDescription="Enter the title for the icon." fieldLabel="Title" name="./title" required="{Boolean}true"/> </item> </items> </field> </multifieldDialog>


Hope that helps!

Regards,
Santosh

Santosh Sai