在CQ5中获取默认选中的复选框

jus*_*der 16 aem

我正在尝试在编辑时在组件对话框上设置默认选中复选框.以下是该领域的属性:

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)
Run Code Online (Sandbox Code Playgroud)

Dav*_*ine 17

是的,看起来文档有点不稳定.我做了一些实验,这个属性的组合对我有用:

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

defaultValue属性似乎是键.

你有主要类型的cq:Widget,而不是widget,不是吗?

  • 非常感谢.我不会自己设计这种组合.来吧,Adobe,更好地管理您的文档! (2认同)

小智 5

将此保存为布尔值...

<nodeName
jcr:primaryType="cq:Widget" 
fieldLabel="check this nodename" 
name="./nodeName" 
defaultValue="{Boolean}false" 
type="checkbox"
xtype="selection" />

<nodeNameHint
  jcr:primaryType="cq:Widget"
  ignoreData="{Boolean}true"
  name="./nodeName@TypeHint"
  value="Boolean"
  xtype="hidden"/>
Run Code Online (Sandbox Code Playgroud)