Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Default Checked Checkbox in CQ5

Tags:

aem

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)
like image 798
justacoder Avatar asked May 07 '12 14:05

justacoder


1 Answers

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?

like image 55
David Gorsline Avatar answered Sep 30 '22 16:09

David Gorsline