【问题标题】:Select value from xtype selection type checkbox CQ5从 xtype 选择类型复选框 CQ5 中选择值
【发布时间】:2013-06-14 09:58:27
【问题描述】:

您好,我现在正在处理一个问题。我想使复选框状态:选中但我无法使 defaultValue="value"

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

我尝试过这样做:Getting Default Checked Checkbox in CQ5

但它并没有解决问题。

【问题讨论】:

  • /bin/sample/private/getJSON.json 返回什么?

标签: adobe aem


【解决方案1】:

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

<channels
   jcr:primaryType="cq:Widget"
   fieldLabel="Channels"
   name="channels"
   type="checkbox"
   defaultValue="true"
   xtype="selection"/>

【讨论】:

    【解决方案2】:

    试着这样写。

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

    【讨论】:

      【解决方案3】:

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

      在您的情况下,要使其在您的 dialog.xml 文件中自动检查,您需要使用 checked="true"。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-10-07
        • 1970-01-01
        • 2018-09-19
        相关资源
        最近更新 更多