DEV Community

Cover image for Really? Preselected checkbox not working, common AEM?
Matija Kovaček
Matija Kovaček

Posted on • Originally published at devz.life on

Really? Preselected checkbox not working, common AEM?

Why one simple preselected checkbox doesn't work in page properties?

Today I needed to add one, simple checbox in page properties and it should be preselected by default. Sounds simple, 5 min task, yea sure....

Since I'm not doing this stuff so often I needed to check granite documentation to see how to achive it. Looks simple, I found properties what I need ( value , uncheckedValue , checked ).

<showSomething
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
    cq:showOnCreate="{Boolean}true"
    text="Please be preselected by default"
    name="./showSomething"
    checked="{Boolean}true" // tried also with string "true"
    value="{Boolean}true" // "true"
    uncheckedValue="{Boolean}false" /> //"false"
Enter fullscreen mode Exit fullscreen mode

And of course it doesn't work in page properties just in component dialog...

Since I'm tired of doing some hacks or writing Javascript to get this stuff working, I just switched dialog to hideSomething so that not preselected checkbox have sense.

I don't understand how that kind of simple things doesn't work as expected OOTB.

Share your ridiculous cases which doesn't work? :D

Top comments (0)