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

Nested Multifield within multifield in content fragment model not working in aem .

Avatar

Level 1

Want a multifield inside multifield in content fragment model , have tried with custom js and dialog but still not working any idea please share it .

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @padmanabhsaoji 

  1. Define the outer multifield: In your Content Fragment Model, define the outer multifield as you normally would. 

    {
        "title": "My Multifield",
        "name": "./myMultifield",
        "fieldLabel": "My Multifield",
        "xtype": "multifield",
        "addLabel": "Add Item",
        "fieldConfig": {
            "xtype": "textfield",
            "name": "./myTextField",
            "fieldLabel": "My Text Field"
        }
    }
    
  2. Define the inner multifield: In the fieldConfig object of the outer multifield, define the inner multifield as a custom xtype. For example:

    {
        "title": "My Multifield",
        "name": "./myMultifield",
        "fieldLabel": "My Multifield",
        "xtype": "multifield",
        "addLabel": "Add Item",
        "fieldConfig": {
            "xtype": "custommultifield",
            "name": "./myCustomMultifield",
            "fieldLabel": "My Custom Multifield"
        }
    }
    
  3. Define the custom xtype: In your Content Fragment Model's client library, define the custom xtype for the inner multifield. For example:

    CQ.Ext.define("myproject.CustomMultifield", {
        extend: "CQ.form.MultiField",
        constructor: function(config) {
            config = config || {};
            var defaults = {
                "fieldConfig": {
                    "xtype": "textfield",
                    "name": "./myInnerTextField",
                    "fieldLabel": "My Inner Text Field"
                }
            };
            config = CQ.Util.applyDefaults(config, defaults);
            myproject.CustomMultifield.superclass.constructor.call(this, config);
        }
    });
    
  4. Include the client library: In your Content Fragment Model's dialog, include the client library that defines the custom xtype. For example:

    <cq:dialog
        ...
        <cq:includeClientLib categories="myproject.custommultifield"/>
        ...
    </cq:dialog>

    https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/nested-multifield-in-conte... 
    https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/multifield-in-content-frag... 



View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @padmanabhsaoji 

  1. Define the outer multifield: In your Content Fragment Model, define the outer multifield as you normally would. 

    {
        "title": "My Multifield",
        "name": "./myMultifield",
        "fieldLabel": "My Multifield",
        "xtype": "multifield",
        "addLabel": "Add Item",
        "fieldConfig": {
            "xtype": "textfield",
            "name": "./myTextField",
            "fieldLabel": "My Text Field"
        }
    }
    
  2. Define the inner multifield: In the fieldConfig object of the outer multifield, define the inner multifield as a custom xtype. For example:

    {
        "title": "My Multifield",
        "name": "./myMultifield",
        "fieldLabel": "My Multifield",
        "xtype": "multifield",
        "addLabel": "Add Item",
        "fieldConfig": {
            "xtype": "custommultifield",
            "name": "./myCustomMultifield",
            "fieldLabel": "My Custom Multifield"
        }
    }
    
  3. Define the custom xtype: In your Content Fragment Model's client library, define the custom xtype for the inner multifield. For example:

    CQ.Ext.define("myproject.CustomMultifield", {
        extend: "CQ.form.MultiField",
        constructor: function(config) {
            config = config || {};
            var defaults = {
                "fieldConfig": {
                    "xtype": "textfield",
                    "name": "./myInnerTextField",
                    "fieldLabel": "My Inner Text Field"
                }
            };
            config = CQ.Util.applyDefaults(config, defaults);
            myproject.CustomMultifield.superclass.constructor.call(this, config);
        }
    });
    
  4. Include the client library: In your Content Fragment Model's dialog, include the client library that defines the custom xtype. For example:

    <cq:dialog
        ...
        <cq:includeClientLib categories="myproject.custommultifield"/>
        ...
    </cq:dialog>

    https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/nested-multifield-in-conte... 
    https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/multifield-in-content-frag... 



Avatar

Administrator

@padmanabhsaoji Did you find the suggestion helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni