Archit Arora
Archit Arora

Reputation: 2636

Checkbox in Touch UI dialog not returning a Boolean value - AEM 6.2

I have created a touch UI dialog that has a check box. I have used the post servlet suffix @TypeHint so that the returned value is a Boolean (true or false)

My Code -

<enableTooltip
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/checkbox"
name="./enableTooltip"
text="Enable tooltip?"
value="true"/>

<enableTooltipType
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/hidden"
name="./enableTooltip@TypeHint"
value="Boolean"/>

Now when I try to run this sightly statement -

<p data-sly-test="${properties.enableTooltip}">This is test data</p>

"This is test data" is always printed irrespective of the fact whether the checkbox is checked or not. What's wrong?

Thanks in advance!

Upvotes: 1

Views: 7058

Answers (1)

Amogh Daryapurkar
Amogh Daryapurkar

Reputation: 51

According to the documentation https://docs.adobe.com/docs/en/aem/6-3/develop/ref/granite-ui/api/jcr_root/libs/granite/ui/components/foundation/form/checkbox/index.html what you have done is right. You can try below sample, this perfectly works for me in AEM 6.2:

In Dialog:

<myCheckbox
                            jcr:primaryType="nt:unstructured"
                            sling:resourceType="granite/ui/components/foundation/form/checkbox"
                            name="./selected" text="Show Checkbox Value" 
                            uncheckedValue="false"
                            value="{Boolean}true"/>

In Html:

<h1 data-sly-test.selected="${properties.selected}" >${selected}</h1>

Upvotes: 3

Related Questions