Checkbox inside multifield | Community
Skip to main content
New Participant
October 5, 2018
Solved

Checkbox inside multifield

  • October 5, 2018
  • 11 replies
  • 4775 views

Hi Guys,

Someone have a problem putting checkbox inside multifield? I was using adobe aem 6.4 with package acs-aem-commons-content-3.18.2.zip.

I''l try save the checkbox value in JSON format.

My problem is always save value=true. When I checked ou unchecked the checkbox.

Follow bellow my cq:dialog xml.

<extracontentnovo

                        cq:showOnCreate="{Boolean}true"

                        jcr:primaryType="nt:unstructured"

                        jcr:title="Menu"

                        sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns"

                        margin="{Boolean}true">

                        <items jcr:primaryType="nt:unstructured">

                            <headerRow

                                jcr:primaryType="nt:unstructured"

                                sling:resourceType="granite/ui/components/foundation/form/textfield"

                                fieldLabel="Header Row"

                                name="./headerRow"/>

                            <columns

                                jcr:primaryType="nt:unstructured"

                                sling:resourceType="granite/ui/components/foundation/form/multifield"

                                class="full-width"

                                fieldLabel="Columns">

                                <field

                                    jcr:primaryType="nt:unstructured"

                                    jcr:title="Column"

                                    sling:resourceType="granite/ui/components/foundation/form/fieldset"

                                    acs-commons-nested="JSON_STORE"

                                    name="./compareColumns">

                                    <layout

                                        jcr:primaryType="nt:unstructured"

                                        sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"

                                        method="absolute"/>

                                    <items jcr:primaryType="nt:unstructured">

                                        <columns

                                            jcr:primaryType="nt:unstructured"

                                            sling:resourceType="granite/ui/components/foundation/container">

                                            <items jcr:primaryType="nt:unstructured">

                                                <checkbox

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"

                                                    fieldDescription="Checking will add a check icon"

                                                    name="./checkbox"

                                                    text="Add Checkbox"

                                                    checked="{Boolean}false"

                                                    value="{Boolean}true"

                                                    deleteHint="{Boolean}false"/>                                            

                                                <description

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="granite/ui/components/foundation/form/textfield"

                                                    fieldLabel="Description"

                                                    name="./description"/>

                                                <path

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="granite/ui/components/foundation/form/pathbrowser"

                                                    fieldLabel="Path"

                                                    name="./linkPath"

                                                    rootPath="/content/fifth-third"/>

                                                <pathtext

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="granite/ui/components/foundation/form/textfield"

                                                    fieldLabel="Link Text"

                                                    name="./linkText"/>

                                            </items>

                                        </columns>

                                    </items>

                                </field>

                            </columns>

                        </items>

                    </extracontentnovo>

Can anyone help me?

Regards

Alisson Xavier

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 smacdonald2008

We are you using package acs-aem-commons-content-3.18.2.zip?

For granite/coral resource types - there is no need to use that package. See this AEM article - that includes the use of a checkbox in a MF -

Building Experience Manager Components using Granite/Coral Resource Types

11 replies

Peter_Puzanovs
New Participant
October 5, 2018

Dear Allison,

Please change granite/ui/components/coral/foundation/form/checkbox to granite/ui/components/foundation/form/checkbox.

Working example(please note I have removed Text as it was not needed for multifield):

<extracontentnovo
   cq:showOnCreate="{Boolean}true"
   jcr:primaryType="nt:unstructured"
   jcr:title="Menu"
   sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns"
   margin="{Boolean}true">

   <items jcr:primaryType="nt:unstructured">

   <columns
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/multifield"
   class="full-width"
   fieldLabel="Columns">

   <field
   jcr:primaryType="nt:unstructured"
   jcr:title="Column"
   sling:resourceType="granite/ui/components/foundation/form/fieldset"
   acs-commons-nested="JSON_STORE"
   name="./compareColumns">

   <layout
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
   method="absolute"/>

   <items jcr:primaryType="nt:unstructured">

   <columns
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/container">

   <items jcr:primaryType="nt:unstructured">

   <checkbox
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/checkbox"
   fieldDescription="Checking will add a check icon"
   name="./checkbox"
   text="Add Checkbox"
   checked="{Boolean}false"
   value="{Boolean}true"
   deleteHint="{Boolean}false"/>

   <description
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/textfield"
   fieldLabel="Description"
   name="./description"/>

   <path
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/pathbrowser"
   fieldLabel="Path"
   name="./linkPath"
   rootPath="/content/fifth-third"/>

   <pathtext
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/textfield"
   fieldLabel="Link Text"
   name="./linkText"/>

   </items>

   </columns>

   </items>

   </field>

   </columns>

   </items>

</extracontentnovo>

Regards,

Peter