Custom Multifield is not working in AEM 6.3
Solved! Go to Solution.
In 6.3, there need to be an update - I have let the team know there is an issue.
Thanks smacdonald2008 and Ratna Kumar.
Issue is resolved now after installing the instance once again and deploying the helpx article.
Its not working with this structure also
Update on use of MULTIFIELD IN AEM 6.3. Use Granite/Coral as mentioned here:
Creating a Granite/Coral 6.3 Multifield HTL component for Adobe Experience Manager
Hi smacdonald2008, There seems to be an issue with the multifield from both '/libs/granite/ui/components/foundation/form/multifield' and also from '/libs/granite/ui/components/coral/foundation/form/multifield' in handling boolean types.
If I use a 'switch' or a 'checkbox' inside the multifield then the value it takes is always true. I tried with different variations but it doesn't work at all.
Attached images of implementation.
Added the multifield.
Added the boolean type switch
This is the dialog.
Adding values to the dialog. 1st is true, 2nd false and 3rd is true.
It stores everything as true :/
Any idea what could be causing this ?
if you define as checkbox, add uncheckedValue there. See an example below.
<hide_image
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
fieldDescription="This checkbox"
name="./hideImage"
text="Hide Image"
uncheckedValue="false"
checked="${not empty cqDesign.hideImage ? cqDesign.hideImage : false}"
value="true"/>
How are you reading this value - are you using Sling Model?
In case of a switch I tried setting a custom value but still no luck. I have created another thread since boolean type issue.
AEM 6.3 Multifield not able to support boolean type resource
Its setting the custom set value to all of them. I would expect it to be something like this :
{"firstTitle":"T1", "sale":"enable"}
{"firstTitle":"T2", "sale":" "}
{"firstTitle":"T3", "sale":"enable"}
Reading the value is not a problem for me. I can use the Sling Model, Sightly or ${properties.items} for the same. But this is more when I save the value from dialog itself.
I have opened a thread specifically for boolean type issue so its not mixed with other issue of multifield.
AEM 6.3 Multifield not able to support boolean type resource
I tried setting custom value to switch as replied to BigT168 in above post but got the same value in all of them in crx.
{"firstTitle":"T1", "sale":"enable"}
{"firstTitle":"T2", "sale":"enable"}
{"firstTitle":"T3", "sale":"enable"}
instead I would expect it to be :
{"firstTitle":"T1", "sale":"enable"}
{"firstTitle":"T2", "sale":" "}
{"firstTitle":"T3", "sale":"enable"}
ALl of this stuff will be explained in this doc coming soon -- Scott's Digital Community: Building Experience Manager Component using Granite/Coral Resource Types
can you show me the dialog definition? It should work.
In this Doc - we cover checkboxes in a MF -- this MF works - See MF Dialog...
Here is the output --
This is the definition of the dialog:
<?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="Test Carousel"
sling:resourceType="cq/gui/components/authoring/dialog"
helpPath="en/cq/current/wcm/default_components.html#Carousel">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/tabs"
type="nav"/>
<items jcr:primaryType="nt:unstructured">
<design
jcr:primaryType="nt:unstructured"
jcr:title="Design"
sling:resourceType="granite/ui/components/foundation/section">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/switch"
fieldLabel="Layout"
name="./layout"
offText="square"
onText="portrait"/>
</items>
</column>
</items>
</design>
<title
jcr:primaryType="nt:unstructured"
jcr:title="Title"
sling:resourceType="granite/ui/components/foundation/section">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<mainTitle
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="Main title"
name="./mainTitle"/>
<paragraph
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="Paragraph"
name="./paragraph"/>
</items>
</column>
</items>
</title>
<itemsBox
jcr:primaryType="nt:unstructured"
jcr:title="Items"
sling:resourceType="granite/ui/components/foundation/section"
id="itemsTab">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
margin="{Boolean}false"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<multiItems
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
fieldLabel="Add 3 items">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/fieldset"
eaem-multifield=""
name="./items">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<firstTitle
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="First Title"
name="./firstTitle"/>
<sale
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/switch"
fieldDescription="Enable this option to apply sale styling to the text."
fieldLabel="Sale"
name="./sale"
offText="Off"
onText="On"
value="enable"/>
</items>
</column>
</items>
</field>
</multiItems>
</items>
</column>
</items>
</itemsBox>
</items>
</content>
</jcr:root>
Hi Scott,
I see you have selected true value for both the checkboxes. Can you try enabling 1 checkbox and disabling the other and see the output again ?
Also can you share the dialog xml so I can have a look ? Also I wanted to see what would be different when using 'switch'
Tnx
I think you use mix the foundation class, one with coral and one without coral. I add the sale into my dialog, it works for me. The value is false by default otherwise it is enable.
If you use all coral foundation class in the dialog, the multifield will store each one as node instead string array.
Hi BigT168,
Initially I tried all without coral UI but still I couldn't make it work. I want it i a form of a json so if you say using coral makes it in a node form then I would like to get it work without coral foundation so I can get in form a json in a property. Is that something you have tried ? To get something like below coz that's where things are going bit wrong :
{"firstTitle":"T1", "sale":"enable"}
{"firstTitle":"T2", "sale":"false"}
{"firstTitle":"T3", "sale":"enable"}
I just tried, it doesn't work without coral foundation.
Hi BigT168, the issue was with eaem-multifield=“” for coral ui 2. It should be acs-commons-nested=“” in the dialog above when using coral ui2 components.
Coral UI 3 makes it in a form of node and Coral UI 2 keeps it in json format and I wanted it in json.
Views
Likes
Replies