AEM 6.1 Touch Ui checkbox, how to get it unchecked while reopening the dialog. | Community
Skip to main content
jydps87387977
Level 3
March 16, 2016
Solved

AEM 6.1 Touch Ui checkbox, how to get it unchecked while reopening the dialog.

  • March 16, 2016
  • 25 replies
  • 39084 views

[Thread Edited By Adobe]

/*Don’t forget to meet and greet your fellow peers virtually by telling them about yourself here

Go ahead and to it now: https://adobe.ly/3eDnB4v */

 

Actual Post:

Hi,

Using AEM 6.1, Touch Ui dialogs, I have a checkbox (checked by default).

 

1. Checkbox is checked (first time, be default)

2. Uncheck the checkbox and submit the dialog

3. Open the dialog, it is still checked.

Question: Is there any way to uncheck the checkbox in Step 3 above

 

 

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 Tyler_Maynard

After playing around, here is the approach I use now involves using cq:template to prefill the resource with a checked value. Just make sure the name of the value you are saving, and the value that is set when checked are present in the cq:template.

Component:

cq: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="Checkbox" sling:resourceType="cq/gui/components/authoring/dialog" helpPath="en/cq/current/wcm/default_components.html#Image"> <content jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/container"> <layout jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns" margin="{Boolean}false" type="nav"/> <items jcr:primaryType="nt:unstructured"> <column jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/container"> <items jcr:primaryType="nt:unstructured"> <hideMobile jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/checkbox" name="./myValue" text="Check By Default" value="isChecked"/> </items> </column> </items> </content> </jcr:root>

 

cq:template

<?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" myValue="isChecked"> </jcr:root>

 

checkbox.html

<h1>${properties.myValue}</h1>


 

25 replies

Level 2
April 19, 2017

Which AEM version are you using, I am facing this issue in AEM 6.1. Do you have any idea if there is a day care hotfix for the same or has it been fixed in AEM 6.2? Do let me know. 

Level 2
June 2, 2017

This worked for me:

<registerNow
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/foundation/form/checkbox"
    fieldDescription="When checked, the Register Now section button appears on the page for members to use"
    text="Register Now"
    name="./registerNow"
    value="{Boolean}true"/>
<registerNowType
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/foundation/form/hidden"
    name="./registerNow@TypeHint"
    value="Boolean"/>
<registerNowDefaultValue
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/foundation/form/hidden"
    name="./registerNow@DefaultValue"
    value="{Boolean}true" />
  1. When adding a new component, the checkbox is checked.
  2. Unchecking the checkbox in the dialog is saved.
  3. Checkbox remains unchecked when opening the dialog.
suresh3366
Level 1
August 10, 2017

Steps to achieve this

Create nt:unstructured node with sling:resourceType = granite/ui/components/foundation/form/checkbox

Add defaultChecked property (boolean) true

Add “uncheckedValue” property. Assign value to it that which should be saved on the node when checkbox is not checked.

Add “value” property.  The value of this property will be saved on the node when checkbox is selected.

example:

<checkbox

                                                            jcr:primaryType="nt:unstructured"

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

                                                            filedDescription="Select Checkbox"

                                                            name="./checkBox"

                                                            text="Checkbox"

                                                            value="true"

                                                            defaultChecked="{Boolean}true"

                                                            uncheckedValue="false"/>

tried and tested

akashs51893872
Level 3
January 16, 2019

This worked for me with Coral component:

shreyaj70113487
May 2, 2019

Add “uncheckedValue” property. Assign value to it that which should be saved on the node when checkbox is not checked.

Can you please suggest how the same works for classic UI in AEM 6.0