Checkbox Checked By Default
The use-case I am going to document is very trivial yet we tend to forget the solution for it.
Problem Statement : When we open the component dialog, the checkbox should be checked by default and on saving the dialog checkbox value should be stored as true.
Get Nibedita Nandi’s stories in your inbox
Join Medium for free to get updates from this writer.
Resolution :
- First, create a dialog with a checkbox and make sure to add its sling:resourceType = granite/ui/components/coral/foundation/form/checkbox
- Add value property(boolean) true.
- Add checked property(boolean) true.
- Make sure to have name property against which the field value gets stored in JCR.
- Add a text property which appears as the label for the field in the dialog.
That’s it.
6. Checkbox gets checked by default when we open the dialog.
7. When we save the dialog on the page, checkedCheckbox gets true value.








