Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Nested Multifield using generator

Avatar

Level 1

Hi,

 

I would like to know if it is possible to create a nested multiflied using generator. I tried this and failed. Is there a specific command for this case?

2 Replies

Avatar

Community Advisor

Hi,

You can let us know which generator have you used? There is no such tool provided OOTB.

Avatar

Community Advisor

Hi @palomacha1001 , I'm not sure how far AEM Component Generator helps for building Nested Multifield.

I recommend following these simple steps from an article by my colleague @Kiran_Vedantam .  https://allaembykiran.wordpress.com/2021/01/13/nested-multi-field/ 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:granite="http://www.adobe.com/jcr/granite/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
    jcr:primaryType="nt:unstructured"
    jcr:title="Nested Multifield"
    sling:resourceType="cq/gui/components/authoring/dialog">
    <content
        jcr:primaryType="nt:unstructured"
        sling:resourceType="granite/ui/components/foundation/container">
        <layout
            jcr:primaryType="nt:unstructured"
            sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
            margin="{Boolean}false"/>
        <items jcr:primaryType="nt:unstructured">
            <column
                jcr:primaryType="nt:unstructured"
                sling:resourceType="granite/ui/components/foundation/container">
                <items jcr:primaryType="nt:unstructured">
                    <firstMF
                        jcr:primaryType="nt:unstructured"
                        sling:resourceType="granite/ui/components/foundation/container">
                        <items jcr:primaryType="nt:unstructured">
                            <files
                                granite:class="multifield-class"
                                granite:data="multifielddata"
                                jcr:primaryType="nt:unstructured"
                                sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
                                class="full-width"
                                composite="{Boolean}true"
                                fieldLabel="First Multi Field"
                                validation="multi-validate">
                                <field
                                    jcr:primaryType="nt:unstructured"
                                    sling:resourceType="granite/ui/components/coral/foundation/container"
                                    name="./firstMF">
                                    <items jcr:primaryType="nt:unstructured">
                                        <heading
                                            jcr:primaryType="nt:unstructured"
                                            sling:resourceType="granite/ui/components/foundation/form/textfield"
                                            fieldLabel="Heading"
                                            name="./heading"
                                            required="{Boolean}true"/>
                                        <secondMF
                                            jcr:primaryType="nt:unstructured"
                                            sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
                                            composite="{Boolean}true"
                                            fieldLabel="Second Multi Field">
                                            <field
                                                jcr:primaryType="nt:unstructured"
                                                sling:resourceType="granite/ui/components/coral/foundation/container"
                                                name="./secondMF">
                                                <items jcr:primaryType="nt:unstructured">
                                                    <label
                                                        jcr:primaryType="nt:unstructured"
                                                        sling:resourceType="granite/ui/components/foundation/form/textfield"
                                                        fieldLabel="Link - Label"
                                                        name="./label"
                                                        required="{Boolean}false"/>
                                                    <url
                                                        jcr:primaryType="nt:unstructured"
                                                        sling:resourceType="granite/ui/components/foundation/form/pathbrowser"
                                                        fieldLabel="URL"
                                                        name="./url"
                                                        required="{Boolean}false"
                                                        rootPath="/content"/>
                                                </items>
                                            </field>
                                        </secondMF>
                                    </items>
                                </field>
                            </files>
                        </items>
                    </firstMF>
                </items>
            </column>
        </items>
    </content>
</jcr:root>

Hope this Helps,

~Aditya.Ch