Expand my Community achievements bar.

SOLVED

Multifield data is not rendering after saving the dialog with data. Below is the code, please help

Avatar

Level 1

Model: 

 

package com.adobe.aem.guides.sabb.core.models;

import java.util.List;

import javax.inject.Inject;

import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.DefaultInjectionStrategy;
import org.apache.sling.models.annotations.Model;

@Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public interface Article {
    @Inject
    List<Articles> getArticles();

    @Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
    interface Articles {
        @Inject
        String getArticleTitle();

        @Inject
        String getArticleDate();

        @Inject
        String getArticleDescription();
    }
}
 
 
dialog xml: 
 
<?xml version="1.0" encoding="UTF-8"?>
    jcr:primaryType="nt:unstructured"
    jcr:title="Properties"
    sling:resourceType="cq/gui/components/authoring/dialog">
    <content
        jcr:primaryType="nt:unstructured"
        sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
        <items jcr:primaryType="nt:unstructured">
            <column
                jcr:primaryType="nt:unstructured"
                sling:resourceType="granite/ui/components/coral/foundation/container">
                <items jcr:primaryType="nt:unstructured">
                  <articles
            jcr:primaryType="nt:unstructured"
            sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
            fieldDescription="">
            <field
              jcr:primaryType="nt:unstructured"
              sling:resourceType="granite/ui/components/coral/foundation/container"
              name="./articles">
              <items jcr:primaryType="nt:unstructured">
                <articleTitle
                  jcr:primaryType="nt:unstructured"
                  sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
                  fieldLabel="Comp. Name"
                  name="./articleTitle"/>
        <dateTime
    jcr:primaryType="nt:unstructured"
    sling:resourceType="/libs/granite/ui/components/coral/foundation/form/datepicker"
    emptyText="Date/Time"
    fieldLabel="Date/Time"
    type="datetime"
    minDate="today"
    name="./articleDate"/>
<articledescription
                        jcr:primaryType="nt:unstructured"
                        sling:resourceType="cq/gui/components/authoring/dialog/richtext"
                        fieldDescription="A description to display as the subheadline for the teaser."
                        fieldLabel=""
                        name="./articleDescription"
                        useFixedInlineToolbar="{Boolean}true">
                        <rtePlugins jcr:primaryType="nt:unstructured">
                            <format
                                jcr:primaryType="nt:unstructured"
                                features="bold,italic"/>
                            <justify
                                jcr:primaryType="nt:unstructured"
                                features="-"/>
                            <links
                                jcr:primaryType="nt:unstructured"
                                features="modifylink,unlink"/>
                            <lists
                                jcr:primaryType="nt:unstructured"
                                features="*"/>
                            <misctools jcr:primaryType="nt:unstructured">
                                <specialCharsConfig jcr:primaryType="nt:unstructured">
                                    <chars jcr:primaryType="nt:unstructured">
                                        <default_copyright
                                            jcr:primaryType="nt:unstructured"
                                            entity="&amp;copy;"
                                            name="copyright"/>
                                        <default_euro
                                            jcr:primaryType="nt:unstructured"
                                            entity="&amp;euro;"
                                            name="euro"/>
                                        <default_registered
                                            jcr:primaryType="nt:unstructured"
                                            entity="&amp;reg;"
                                            name="registered"/>
                                        <default_trademark
                                            jcr:primaryType="nt:unstructured"
                                            entity="&amp;trade;"
                                            name="trademark"/>
                                    </chars>
                                </specialCharsConfig>
                            </misctools>
                            <paraformat
                                jcr:primaryType="nt:unstructured"
                                features="*">
                                <formats jcr:primaryType="nt:unstructured">
                                    <default_p
                                        jcr:primaryType="nt:unstructured"
                                        description="Paragraph"
                                        tag="p"/>
                                    <default_h1
                                        jcr:primaryType="nt:unstructured"
                                        description="Heading 1"
                                        tag="h1"/>
                                    <default_h2
                                        jcr:primaryType="nt:unstructured"
                                        description="Heading 2"
                                        tag="h2"/>
                                    <default_h3
                                        jcr:primaryType="nt:unstructured"
                                        description="Heading 3"
                                        tag="h3"/>
                                    <default_h4
                                        jcr:primaryType="nt:unstructured"
                                        description="Heading 4"
                                        tag="h4"/>
                                    <default_h5
                                        jcr:primaryType="nt:unstructured"
                                        description="Heading 5"
                                        tag="h5"/>
                                    <default_h6
                                        jcr:primaryType="nt:unstructured"
                                        description="Heading 6"
                                        tag="h6"/>
                                    <default_blockquote
                                        jcr:primaryType="nt:unstructured"
                                        description="Quote"
                                        tag="blockquote"/>
                                    <default_pre
                                        jcr:primaryType="nt:unstructured"
                                        description="Preformatted"
                                        tag="pre"/>
                                </formats>
                            </paraformat>
                            <table
                                jcr:primaryType="nt:unstructured"
                                features="-">
                                <hiddenHeaderConfig
                                    jcr:primaryType="nt:unstructured"
                                    hiddenHeaderClassName="cq-wcm-foundation-aria-visuallyhidden"
                                    hiddenHeaderEditingCSS="cq-RichText-hiddenHeader--editing"/>
                            </table>
                            <tracklinks
                                jcr:primaryType="nt:unstructured"
                                features="*"/>
                        </rtePlugins>
                        <uiSettings jcr:primaryType="nt:unstructured">
                            <cui jcr:primaryType="nt:unstructured">
                                <inline
                                    jcr:primaryType="nt:unstructured"
                                    toolbar="[format#bold,format#italic,format#underline,#justify,#lists,links#modifylink,links#unlink,#paraformat]">
                                    <popovers jcr:primaryType="nt:unstructured">
                                        <justify
                                            jcr:primaryType="nt:unstructured"
                                            items="[justify#justifyleft,justify#justifycenter,justify#justifyright]"
                                            ref="justify"/>
                                        <lists
                                            jcr:primaryType="nt:unstructured"
                                            items="[lists#unordered,lists#ordered,lists#outdent,lists#indent]"
                                            ref="lists"/>
                                        <paraformat
                                            jcr:primaryType="nt:unstructured"
                                            items="paraformat:getFormats:paraformat-pulldown"
                                            ref="paraformat"/>
                                    </popovers>
                                </inline>
                                <dialogFullScreen
                                    jcr:primaryType="nt:unstructured"
                                    toolbar="[format#bold,format#italic,format#underline,justify#justifyleft,justify#justifycenter,justify#justifyright,lists#unordered,lists#ordered,lists#outdent,lists#indent,links#modifylink,links#unlink,table#createoredit,#paraformat,image#imageProps]">
                                    <popovers jcr:primaryType="nt:unstructured">
                                        <paraformat
                                            jcr:primaryType="nt:unstructured"
                                            items="paraformat:getFormats:paraformat-pulldown"
                                            ref="paraformat"/>
                                    </popovers>
                                </dialogFullScreen>
                                <tableEditOptions
                                    jcr:primaryType="nt:unstructured"
                                    toolbar="[table#insertcolumn-before,table#insertcolumn-after,table#removecolumn,-,table#insertrow-before,table#insertrow-after,table#removerow,-,table#mergecells-right,table#mergecells-down,table#mergecells,table#splitcell-horizontal,table#splitcell-vertical,-,table#selectrow,table#selectcolumn,-,table#ensureparagraph,-,table#modifytableandcell,table#removetable,-,undo#undo,undo#redo,-,table#exitTableEditing,-]"/>
                            </cui>
                        </uiSettings>
                    </articledescription>
              </items>
            </field>
          </articles>
                </items>
            </column>
        </items>
    </content>
</jcr:root>
 
 
htl:
 
<div data-sly-use.model="com.adobe.aem.guides.sabb.core.models.Article">
    <div data-sly-list.items="${model.articles}">
        <h1>${items.articleTitle}</h1>
        <h2>${items.articleDate}</h2>
        <p>${items.description @ context = 'html'}</p>
    </div>
</div>
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @Bharath2 ,
You have missed 

composite="{Boolean}true"

 

Try with this code,

 

<?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" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
          jcr:primaryType="nt:unstructured"
          jcr:title="Properties"
          sling:resourceType="cq/gui/components/authoring/dialog">
    <content
            jcr:primaryType="nt:unstructured"
            sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
        <items jcr:primaryType="nt:unstructured">
            <column
                    jcr:primaryType="nt:unstructured"
                    sling:resourceType="granite/ui/components/coral/foundation/container">
                <items jcr:primaryType="nt:unstructured">
                    <articles
                            jcr:primaryType="nt:unstructured"
                            sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
                            fieldDescription=""
                            composite="{Boolean}true">
                        <field
                                jcr:primaryType="nt:unstructured"
                                sling:resourceType="granite/ui/components/coral/foundation/container"
                                name="./articles">
                            <items jcr:primaryType="nt:unstructured">
                                <articleTitle
                                        jcr:primaryType="nt:unstructured"
                                        sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
                                        fieldLabel="Comp. Name"
                                        name="./articleTitle"/>
                                <dateTime
                                        jcr:primaryType="nt:unstructured"
                                        sling:resourceType="/libs/granite/ui/components/coral/foundation/form/datepicker"
                                        emptyText="Date/Time"
                                        fieldLabel="Date/Time"
                                        type="datetime"
                                        minDate="today"
                                        name="./articleDate"/>
                                <articledescription
                                        jcr:primaryType="nt:unstructured"
                                        sling:resourceType="cq/gui/components/authoring/dialog/richtext"
                                        fieldDescription="A description to display as the subheadline for the teaser."
                                        fieldLabel=""
                                        name="./articleDescription"
                                        useFixedInlineToolbar="{Boolean}true">
                                    <rtePlugins jcr:primaryType="nt:unstructured">
                                        <format
                                                jcr:primaryType="nt:unstructured"
                                                features="bold,italic"/>
                                        <justify
                                                jcr:primaryType="nt:unstructured"
                                                features="-"/>
                                        <links
                                                jcr:primaryType="nt:unstructured"
                                                features="modifylink,unlink"/>
                                        <lists
                                                jcr:primaryType="nt:unstructured"
                                                features="*"/>
                                        <misctools jcr:primaryType="nt:unstructured">
                                            <specialCharsConfig jcr:primaryType="nt:unstructured">
                                                <chars jcr:primaryType="nt:unstructured">
                                                    <default_copyright
                                                            jcr:primaryType="nt:unstructured"
                                                            entity="&amp;copy;"
                                                            name="copyright"/>
                                                    <default_euro
                                                            jcr:primaryType="nt:unstructured"
                                                            entity="&amp;euro;"
                                                            name="euro"/>
                                                    <default_registered
                                                            jcr:primaryType="nt:unstructured"
                                                            entity="&amp;reg;"
                                                            name="registered"/>
                                                    <default_trademark
                                                            jcr:primaryType="nt:unstructured"
                                                            entity="&amp;trade;"
                                                            name="trademark"/>
                                                </chars>
                                            </specialCharsConfig>
                                        </misctools>
                                        <paraformat
                                                jcr:primaryType="nt:unstructured"
                                                features="*">
                                            <formats jcr:primaryType="nt:unstructured">
                                                <default_p
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Paragraph"
                                                        tag="p"/>
                                                <default_h1
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Heading 1"
                                                        tag="h1"/>
                                                <default_h2
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Heading 2"
                                                        tag="h2"/>
                                                <default_h3
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Heading 3"
                                                        tag="h3"/>
                                                <default_h4
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Heading 4"
                                                        tag="h4"/>
                                                <default_h5
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Heading 5"
                                                        tag="h5"/>
                                                <default_h6
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Heading 6"
                                                        tag="h6"/>
                                                <default_blockquote
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Quote"
                                                        tag="blockquote"/>
                                                <default_pre
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Preformatted"
                                                        tag="pre"/>
                                            </formats>
                                        </paraformat>
                                        <table
                                                jcr:primaryType="nt:unstructured"
                                                features="-">
                                            <hiddenHeaderConfig
                                                    jcr:primaryType="nt:unstructured"
                                                    hiddenHeaderClassName="cq-wcm-foundation-aria-visuallyhidden"
                                                    hiddenHeaderEditingCSS="cq-RichText-hiddenHeader--editing"/>
                                        </table>
                                        <tracklinks
                                                jcr:primaryType="nt:unstructured"
                                                features="*"/>
                                    </rtePlugins>
                                    <uiSettings jcr:primaryType="nt:unstructured">
                                        <cui jcr:primaryType="nt:unstructured">
                                            <inline
                                                    jcr:primaryType="nt:unstructured"
                                                    toolbar="[format#bold,format#italic,format#underline,#justify,#lists,links#modifylink,links#unlink,#paraformat]">
                                                <popovers jcr:primaryType="nt:unstructured">
                                                    <justify
                                                            jcr:primaryType="nt:unstructured"
                                                            items="[justify#justifyleft,justify#justifycenter,justify#justifyright]"
                                                            ref="justify"/>
                                                    <lists
                                                            jcr:primaryType="nt:unstructured"
                                                            items="[lists#unordered,lists#ordered,lists#outdent,lists#indent]"
                                                            ref="lists"/>
                                                    <paraformat
                                                            jcr:primaryType="nt:unstructured"
                                                            items="paraformat:getFormats:paraformat-pulldown"
                                                            ref="paraformat"/>
                                                </popovers>
                                            </inline>
                                            <dialogFullScreen
                                                    jcr:primaryType="nt:unstructured"
                                                    toolbar="[format#bold,format#italic,format#underline,justify#justifyleft,justify#justifycenter,justify#justifyright,lists#unordered,lists#ordered,lists#outdent,lists#indent,links#modifylink,links#unlink,table#createoredit,#paraformat,image#imageProps]">
                                                <popovers jcr:primaryType="nt:unstructured">
                                                    <paraformat
                                                            jcr:primaryType="nt:unstructured"
                                                            items="paraformat:getFormats:paraformat-pulldown"
                                                            ref="paraformat"/>
                                                </popovers>
                                            </dialogFullScreen>
                                            <tableEditOptions
                                                    jcr:primaryType="nt:unstructured"
                                                    toolbar="[table#insertcolumn-before,table#insertcolumn-after,table#removecolumn,-,table#insertrow-before,table#insertrow-after,table#removerow,-,table#mergecells-right,table#mergecells-down,table#mergecells,table#splitcell-horizontal,table#splitcell-vertical,-,table#selectrow,table#selectcolumn,-,table#ensureparagraph,-,table#modifytableandcell,table#removetable,-,undo#undo,undo#redo,-,table#exitTableEditing,-]"/>
                                        </cui>
                                    </uiSettings>
                                </articledescription>
                            </items>
                        </field>
                    </articles>
                </items>
            </column>
        </items>
    </content>
</jcr:root>

 

 

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

Hello @Bharath2 ,
You have missed 

composite="{Boolean}true"

 

Try with this code,

 

<?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" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
          jcr:primaryType="nt:unstructured"
          jcr:title="Properties"
          sling:resourceType="cq/gui/components/authoring/dialog">
    <content
            jcr:primaryType="nt:unstructured"
            sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
        <items jcr:primaryType="nt:unstructured">
            <column
                    jcr:primaryType="nt:unstructured"
                    sling:resourceType="granite/ui/components/coral/foundation/container">
                <items jcr:primaryType="nt:unstructured">
                    <articles
                            jcr:primaryType="nt:unstructured"
                            sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
                            fieldDescription=""
                            composite="{Boolean}true">
                        <field
                                jcr:primaryType="nt:unstructured"
                                sling:resourceType="granite/ui/components/coral/foundation/container"
                                name="./articles">
                            <items jcr:primaryType="nt:unstructured">
                                <articleTitle
                                        jcr:primaryType="nt:unstructured"
                                        sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
                                        fieldLabel="Comp. Name"
                                        name="./articleTitle"/>
                                <dateTime
                                        jcr:primaryType="nt:unstructured"
                                        sling:resourceType="/libs/granite/ui/components/coral/foundation/form/datepicker"
                                        emptyText="Date/Time"
                                        fieldLabel="Date/Time"
                                        type="datetime"
                                        minDate="today"
                                        name="./articleDate"/>
                                <articledescription
                                        jcr:primaryType="nt:unstructured"
                                        sling:resourceType="cq/gui/components/authoring/dialog/richtext"
                                        fieldDescription="A description to display as the subheadline for the teaser."
                                        fieldLabel=""
                                        name="./articleDescription"
                                        useFixedInlineToolbar="{Boolean}true">
                                    <rtePlugins jcr:primaryType="nt:unstructured">
                                        <format
                                                jcr:primaryType="nt:unstructured"
                                                features="bold,italic"/>
                                        <justify
                                                jcr:primaryType="nt:unstructured"
                                                features="-"/>
                                        <links
                                                jcr:primaryType="nt:unstructured"
                                                features="modifylink,unlink"/>
                                        <lists
                                                jcr:primaryType="nt:unstructured"
                                                features="*"/>
                                        <misctools jcr:primaryType="nt:unstructured">
                                            <specialCharsConfig jcr:primaryType="nt:unstructured">
                                                <chars jcr:primaryType="nt:unstructured">
                                                    <default_copyright
                                                            jcr:primaryType="nt:unstructured"
                                                            entity="&amp;copy;"
                                                            name="copyright"/>
                                                    <default_euro
                                                            jcr:primaryType="nt:unstructured"
                                                            entity="&amp;euro;"
                                                            name="euro"/>
                                                    <default_registered
                                                            jcr:primaryType="nt:unstructured"
                                                            entity="&amp;reg;"
                                                            name="registered"/>
                                                    <default_trademark
                                                            jcr:primaryType="nt:unstructured"
                                                            entity="&amp;trade;"
                                                            name="trademark"/>
                                                </chars>
                                            </specialCharsConfig>
                                        </misctools>
                                        <paraformat
                                                jcr:primaryType="nt:unstructured"
                                                features="*">
                                            <formats jcr:primaryType="nt:unstructured">
                                                <default_p
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Paragraph"
                                                        tag="p"/>
                                                <default_h1
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Heading 1"
                                                        tag="h1"/>
                                                <default_h2
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Heading 2"
                                                        tag="h2"/>
                                                <default_h3
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Heading 3"
                                                        tag="h3"/>
                                                <default_h4
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Heading 4"
                                                        tag="h4"/>
                                                <default_h5
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Heading 5"
                                                        tag="h5"/>
                                                <default_h6
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Heading 6"
                                                        tag="h6"/>
                                                <default_blockquote
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Quote"
                                                        tag="blockquote"/>
                                                <default_pre
                                                        jcr:primaryType="nt:unstructured"
                                                        description="Preformatted"
                                                        tag="pre"/>
                                            </formats>
                                        </paraformat>
                                        <table
                                                jcr:primaryType="nt:unstructured"
                                                features="-">
                                            <hiddenHeaderConfig
                                                    jcr:primaryType="nt:unstructured"
                                                    hiddenHeaderClassName="cq-wcm-foundation-aria-visuallyhidden"
                                                    hiddenHeaderEditingCSS="cq-RichText-hiddenHeader--editing"/>
                                        </table>
                                        <tracklinks
                                                jcr:primaryType="nt:unstructured"
                                                features="*"/>
                                    </rtePlugins>
                                    <uiSettings jcr:primaryType="nt:unstructured">
                                        <cui jcr:primaryType="nt:unstructured">
                                            <inline
                                                    jcr:primaryType="nt:unstructured"
                                                    toolbar="[format#bold,format#italic,format#underline,#justify,#lists,links#modifylink,links#unlink,#paraformat]">
                                                <popovers jcr:primaryType="nt:unstructured">
                                                    <justify
                                                            jcr:primaryType="nt:unstructured"
                                                            items="[justify#justifyleft,justify#justifycenter,justify#justifyright]"
                                                            ref="justify"/>
                                                    <lists
                                                            jcr:primaryType="nt:unstructured"
                                                            items="[lists#unordered,lists#ordered,lists#outdent,lists#indent]"
                                                            ref="lists"/>
                                                    <paraformat
                                                            jcr:primaryType="nt:unstructured"
                                                            items="paraformat:getFormats:paraformat-pulldown"
                                                            ref="paraformat"/>
                                                </popovers>
                                            </inline>
                                            <dialogFullScreen
                                                    jcr:primaryType="nt:unstructured"
                                                    toolbar="[format#bold,format#italic,format#underline,justify#justifyleft,justify#justifycenter,justify#justifyright,lists#unordered,lists#ordered,lists#outdent,lists#indent,links#modifylink,links#unlink,table#createoredit,#paraformat,image#imageProps]">
                                                <popovers jcr:primaryType="nt:unstructured">
                                                    <paraformat
                                                            jcr:primaryType="nt:unstructured"
                                                            items="paraformat:getFormats:paraformat-pulldown"
                                                            ref="paraformat"/>
                                                </popovers>
                                            </dialogFullScreen>
                                            <tableEditOptions
                                                    jcr:primaryType="nt:unstructured"
                                                    toolbar="[table#insertcolumn-before,table#insertcolumn-after,table#removecolumn,-,table#insertrow-before,table#insertrow-after,table#removerow,-,table#mergecells-right,table#mergecells-down,table#mergecells,table#splitcell-horizontal,table#splitcell-vertical,-,table#selectrow,table#selectcolumn,-,table#ensureparagraph,-,table#modifytableandcell,table#removetable,-,undo#undo,undo#redo,-,table#exitTableEditing,-]"/>
                                        </cui>
                                    </uiSettings>
                                </articledescription>
                            </items>
                        </field>
                    </articles>
                </items>
            </column>
        </items>
    </content>
</jcr:root>

 

 

Avatar

Community Advisor

@Bharath2 you missed composite="{Boolean}true" for the multifield and once you add you will see the items under the component node in the page jcr structure.