Home | Blog

Really? Preselected checkbox not working, common AEM?

Cover Image for Really? Preselected checkbox not working, common AEM?
Matija Kovacek
Matija Kovacek

Really? Preselected checkbox not working, common AEM?

Today I needed to add one, simple checkbox 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 achieve it. Looks simple, I found the properties that 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"

And of course, it doesn't work in page properties just in the 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 thing doesn't work as expected OOTB.

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