AEM 6.5 multifield is not retaining the text field values | Community
Skip to main content
Level 2
March 20, 2020
Solved

AEM 6.5 multifield is not retaining the text field values

  • March 20, 2020
  • 2 replies
  • 5147 views

I have created an multifield component that  stores the  values as string[] in jcr content. But after storing the values when we came back to the dialog the values were not there. Although the values are available in jcr:content of the page.

 

 

<?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"
cq:showOnCreate="{Boolean}false"
jcr:primaryType="nt:unstructured"
jcr:title="Customizations "
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">
<categorycustom
jcr:primaryType="nt:unstructured"
jcr:title="Page Category "
sling:resourceType="granite/ui/components/coral/foundation/form/fieldset">
<items jcr:primaryType="nt:unstructured">
<category
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/multifield">
<field
jcr:primaryType="nt:unstructured"
jcr:title="Category Name"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<category
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Category Name"
key="category"
name="./categoryName"/>
</items>
</field>
</category>
</items>
</categorycustom>
<brandcustom
jcr:primaryType="nt:unstructured"
jcr:title="Brand Name"
sling:resourceType="granite/ui/components/coral/foundation/form/fieldset">
<items jcr:primaryType="nt:unstructured">
<brand
jcr:primaryType="nt:unstructured"
jcr:title="Brand Name"
sling:resourceType="granite/ui/components/coral/foundation/form/multifield">
<field
jcr:primaryType="nt:unstructured"
jcr:title="Brand Name"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<brand
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Brand Name"
key="brand"
multiple="{Boolean}true"
name="./brandName"/>
</items>
</field>
</brand>
</items>
</brandcustom>
</items>
</column>
</items>
</jcr:root>

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

@ravi_shankerj14 

Give this a try:

 

<labelsCollection jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/multifield" composite="{Boolean}true" fieldLabel="Labels Collection" name="./labelsCollection"> <field jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/container" name="./labels"> <items jcr:primaryType="nt:unstructured"> <fieldset jcr:primaryType="nt:unstructured" jcr:title="Label" sling:resourceType="granite/ui/components/coral/foundation/form/fieldset"> <items jcr:primaryType="nt:unstructured"> <label jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/textfield" fieldLabel="Label" name="./label" required="true"/> </items> </fieldset> </items> </field> </labelsCollection>

 

Output:

 

2 replies

Suraj_Kamdi
Community Advisor
Community Advisor
March 20, 2020

@ravi_shankerj14 

In the multifield cq:dialog values are stored in node format and not in String [].

<nav sling:resourceType="granite/ui/components/coral/foundation/form/multifield" fieldLabel="Links" jcr:primaryType="nt:unstructured" composite="{Boolean}true"> <field sling:resourceType="granite/ui/components/coral/foundation/container" jcr:primaryType="nt:unstructured" name="./multifieldProperties"> <items jcr:primaryType="nt:unstructured"> <linkText sling:resourceType="granite/ui/components/coral/foundation/form/textfield" fieldLabel="Link Text" jcr:primaryType="nt:unstructured" name="./linkText" /> </items> </field> </nav>

 

BrianKasingli
Community Advisor and Adobe Champion
BrianKasingliCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
March 20, 2020

@ravi_shankerj14 

Give this a try:

 

<labelsCollection jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/multifield" composite="{Boolean}true" fieldLabel="Labels Collection" name="./labelsCollection"> <field jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/container" name="./labels"> <items jcr:primaryType="nt:unstructured"> <fieldset jcr:primaryType="nt:unstructured" jcr:title="Label" sling:resourceType="granite/ui/components/coral/foundation/form/fieldset"> <items jcr:primaryType="nt:unstructured"> <label jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/textfield" fieldLabel="Label" name="./label" required="true"/> </items> </fieldset> </items> </field> </labelsCollection>

 

Output:

 

Nandujee
Level 3
February 8, 2022

Hi @briankasingli / @ravi_shankerj14 

 

I'm in a kind of same situation that the values are not prepopulating on my dialog, if I add composite = false in the multifield. I'm setting it as false as my old classic components had used custom mulitfield and all the values are stored in a array format. I'm in a process of migrating those component into touch UI and don't want to distrub the existing structure of array. 

 

Since the touch ui mulitfield provides the option to read the array of value with composite = false.I want to utilize it. Sadly, the values are not prepopulate the value. 

 

Do you have the recommendation for this? Your help would be very much appreciated here..

 

Regards,

Nanda