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

3 2 1

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

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay