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>
Solved! Go to Solution.
Views
Replies
Total Likes
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:
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>
Views
Replies
Total Likes
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:
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
Views
Replies
Total Likes