Nested Multifield using generator | Community
Skip to main content
August 4, 2022

Nested Multifield using generator

  • August 4, 2022
  • 2 replies
  • 1272 views

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?

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

2 replies

arunpatidar
Community Advisor
Community Advisor
August 4, 2022

Hi,

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

Arun Patidar
August 4, 2022
AEM Component Generator
arunpatidar
Community Advisor
Community Advisor
August 4, 2022

I think you can raise questions at https://github.com/adobe/aem-component-generator/issues 

Arun Patidar
Aditya_Chabuku
Community Advisor
Community Advisor
August 4, 2022

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

Thanks,Aditya Chabuku