How to provide custom value on checkbox in cq5 dialog?

家住魔仙堡 提交于 2019-12-02 20:29:25

问题


I just created a widget inside my dialog in whose xtype=selection i.e checkbox. Is there any way through which i can get my custom value instead of true and false while select and deselecting the check box. suppose i want to get the value "Yes" when i select the checkbox. the alternative way is to handle it inside the jsp of the component but is it possible to handle it at dialog level ?


回答1:


You can give this a try

{
  xtype: "selection",
  fieldLabel: "Yes/No",
  name: "./yesNo",
  hideLabel: false,
  type: "checkbox",
  allowBlank: true,
  jcr:primaryType: "cq:Widget",
  fieldDescription: "Check for Yes",
  options: {
      jcr:primaryType: "cq:WidgetCollection",
      option0: {
                value: "Yes",
                jcr:primaryType: "nt:unstructured",
                text: ""
               }
         }
}

And when reading it properties.get("yesNo","No")



来源:https://stackoverflow.com/questions/28361998/how-to-provide-custom-value-on-checkbox-in-cq5-dialog

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!