Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Problem with multifield sling resource type

Avatar

Level 3

Hi All,

 

For multifield we are using sling:resourceType=granite/ui/components/coral/foundation/form/multifield as property we are getting problem. In the dialog box Authored content not showing it's showing empty. we replaced  with this  sling:resourceType=granite/ui/components/foundation/form/multifield problem was solved 

can anybody have idea please explain why this problem occuring? 

 

Thankyou. 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @dh54220 ,
For me, granite/ui/components/coral/foundation/form/multifield is perfectly working. Maybe you missed any of the structures.
For reference, I added a sample code. Can you try this?

<?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="Component"
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">
<rows
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
composite="{Boolean}true"
fieldDescription="Click 'Add' to add rows"
fieldLabel="Rows">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container"
name="./rows">
<items jcr:primaryType="nt:unstructured">
<!-- Multifield Items -->
</items>
</field>
</rows>
</items>
</column>
</items>
</content>
</jcr:root>

 

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hello @dh54220 ,
For me, granite/ui/components/coral/foundation/form/multifield is perfectly working. Maybe you missed any of the structures.
For reference, I added a sample code. Can you try this?

<?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="Component"
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">
<rows
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
composite="{Boolean}true"
fieldDescription="Click 'Add' to add rows"
fieldLabel="Rows">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container"
name="./rows">
<items jcr:primaryType="nt:unstructured">
<!-- Multifield Items -->
</items>
</field>
</rows>
</items>
</column>
</items>
</content>
</jcr:root>

 

Avatar

Community Advisor

granite/ui/components/coral/foundation/form/multifield store content in a node structure if you use composite=true

 

but if you don't each property of multifield act as a String array and on load nothing loads.

 

If you are creating a new component then use granite/ui/components/coral/foundation/form/multifield with composite true

Example

https://aemhints.com/2020/10/24/coral-multifield-aem65/ 



Arun Patidar

Avatar

Level 3

I am using granite/ui/components/coral/foundation/form/multifield and composite=true but on load nothing loading. 

Working fine with this one granite/ui/components/foundation/form/multifield and composite=true 

Avatar

Community Advisor

Hi,

Can you share your dialog here?



Arun Patidar