Adobe 从xtype选择类型复选框CQ5中选择值

Adobe 从xtype选择类型复选框CQ5中选择值,adobe,aem,Adobe,Aem,你好,我正在处理一个问题。我想使复选框状态为:选中,但我无法使defaultValue=“value” 我尝试过这样做: 但它并没有解决问题。这是我用来将复选框的默认状态设置为“已选中”的示例。注意defaultValue=“true” 试着这样写 <channels jcr:primaryType="cq:Widget" fieldLabel="Channels" defaultValue="{Boolean}true"

你好,我正在处理一个问题。我想使复选框状态为:选中,但我无法使defaultValue=“value”


我尝试过这样做:


但它并没有解决问题。

这是我用来将复选框的默认状态设置为“已选中”的示例。注意
defaultValue=“true”


试着这样写

<channels jcr:primaryType="cq:Widget" 
          fieldLabel="Channels"
          defaultValue="{Boolean}true" 
          name="channels" options="/bin/sample/private/getJSON.json"
          optionsValueField="Value" 
          type="checkbox" 
          xtype="selection">

您提到的问题是使用js/json创建复选框。 如果查看JCR中实际存储的内容,您将看到复选框对应的值实际上不是布尔值,而是字符串。如果项目位于复选框组内,则可以是true/flase,也可以是on/off


在您的情况下,要在dialog.xml文件中自动选中它,您需要使用checked=“true”。

返回什么?
<channels
   jcr:primaryType="cq:Widget"
   fieldLabel="Channels"
   name="channels"
   type="checkbox"
   defaultValue="true"
   xtype="selection"/>
<channels jcr:primaryType="cq:Widget" 
          fieldLabel="Channels"
          defaultValue="{Boolean}true" 
          name="channels" options="/bin/sample/private/getJSON.json"
          optionsValueField="Value" 
          type="checkbox" 
          xtype="selection">