Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

items and sub nodes are getting reset in Multifield coral UI3 AEM 6.5.

Avatar

Level 1

we have used  sling:resourceType="granite/ui/components/foundation/form/multifield" in aem 6.4. Nodes are created like below and its working fine. we used podComponent inside podsContainer component dialog.

podsContainer

             |

            pods

                 |

                 0

                  |

                 assetPod

 

but when we chaged sling:resourceType="granite/ui/components/coral/foundation/form/multifield" in aem 6.5. Nodes needs to be created in below format. but data is resetting for every dialog submission.

podsContainer

             |

            pods

                 |

                items0

                  |

                 assetPod (not creating)

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @sreenathg397727 ,

 

Please go through below example. It works perfectly with item nodes created in the new structure.

 

_________Dialog______________

<infoItems
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="./infoItems">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<iconUrl
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/pathfield"
fieldLabel="Icon"
name="./iconUrl"
rootPath="/content/dam/"/>
<infoText
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textarea"
fieldLabel="Info Text"
name="./infoText"/>
</items>
</column>
</items>
</field>
</infoItems>
 
________Sling Model_______
@Getter
@Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class InfoItems {

@Inject
private Resource infoItems;
}
________HTL_________
<sly data-sly-use.model="co.sampleapp.InfoItems">
<ul data-sly-list.infoItem="${model.infoItems.listChildren}">
<li><b>Icon: ${infoItem.iconUrl} Text:</b> ${infoItem.infoText}</li>
</ul>
</sly>

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @sreenathg397727 ,

 

Please go through below example. It works perfectly with item nodes created in the new structure.

 

_________Dialog______________

<infoItems
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="./infoItems">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<iconUrl
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/pathfield"
fieldLabel="Icon"
name="./iconUrl"
rootPath="/content/dam/"/>
<infoText
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textarea"
fieldLabel="Info Text"
name="./infoText"/>
</items>
</column>
</items>
</field>
</infoItems>
 
________Sling Model_______
@Getter
@Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class InfoItems {

@Inject
private Resource infoItems;
}
________HTL_________
<sly data-sly-use.model="co.sampleapp.InfoItems">
<ul data-sly-list.infoItem="${model.infoItems.listChildren}">
<li><b>Icon: ${infoItem.iconUrl} Text:</b> ${infoItem.infoText}</li>
</ul>
</sly>

Avatar

Community Advisor

@sreenathg397727 Have you customized the multifield rendering in 6.4 ? The behavior you see in 6.5 is the OOTB rendering behavior. For every item , it will create a node starting items0,items1,... and when each individual field values will go us property in the items node. I would recommend to modify your existing code to match this behavior as this might cause issues for future upgrades. Try to keep customization as less as possible . 

 

Thanks

Veena