Search code examples
aem

Getting Default Checked Checkbox in CQ5


I am trying to have a default checked checkbox on a component dialog when editing. Here are the properties on the field:

jcr:primaryType: widget
checked: true (boolean) *Documentation says this determines default checked status
type: checkbox (string) *read this as a fix to making checkbox selections stick
xtype: selection (string)
name: ./foo (string)
fieldValue: true (string)

Solution

  • Yes, it looks like the documentation is a little wonky. I did some experimenting, and this combination of properties works for me:

    defaultValue (String) true
    fieldLabel (String) Foo Mode
    inputValue (String) false
    jcr:primaryType (Name) cq:Widget
    name (String) ./foomode
    type (String) checkbox
    xtype (String) selection
    

    The defaultValue property appears to be the key.

    You do have cq:Widget for your primary type, not widget, do you not?