Skip to main content
New Participant
June 9, 2022

Error in Displaying multifield value

  • June 9, 2022
  • 3 replies
  • 1792 views

 

cq:dilog 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">
<accordion
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
composite="{Boolean}true"
fieldLabel="News">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container"
name="./multifield">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<description
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Description"
name="./title"/>
</items>
</column>
</items>
</field>
</accordion>
</items>
</column>
</items>
</content>
</jcr:root>


htl code
<pre data-sly-use.hello="com.aem.HDFC_GIGA.core.models.ArticalCardValueModel">
<sly data-sly-list="${hello.articles.listChildren}">
HelloWorldModel says: ${item.title}
</sly>

</pre>

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

New Participant
June 10, 2022

@Inject
@Optional
private Resource multifield;

now i change "private to public" and now i am able to fetch ad display the value  on page

 

but still not getting the node structure

 

DEBAL_DAS
New Participant
June 9, 2022

I feel author's entries like title are getting stored as a multi value property (String[]) and because of it you are facing the issue. Please correct me.

I have tested with your .content.xml associated with cq:dialog and author's entries are getting stored as individual nodes as shown below -

 

composite="{Boolean}true" supports this node structure. Could you please test the component on different page and share your observation with error details.

New Participant
June 10, 2022

as of no new error but node like structure is not created

arunpatidar
New Participant
June 9, 2022

Hi,

what is the issue? what results are you getting and what is expected?

Can you also share the Sling Model code?

Arun Patidar
New Participant
June 10, 2022

i want value to be stored as individual node

 

but it get stored inside parent node

package com.aem.HDFC_GIGA.core.models;

import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Default;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.Optional;
import org.apache.sling.settings.SlingSettingsService;

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;

@Model(adaptables=Resource.class)
public class ArticalCardValueModel {

@Inject
@Optional
private Resource multifield;




@PostConstruct
protected void init() {

}


}

 

arunpatidar
New Participant
June 10, 2022

Hi,

Code looks fine. The node structure should be created with this.

Can you check if you have override the 

granite/ui/components/coral/foundation/form/multifield

 

Arun Patidar