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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

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

sreenathg397727
Level 1
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
ChitraMadan
Correct answer by
Community Advisor
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
ChitraMadan
Correct answer by
Community Advisor
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

Veena_Vikram
Community Advisor
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