adobeaemexperience-manager

How to disable checkboxes 's option in dialog.xml in CQ5 AEM?


I have designed my CQ5 dialog as given in the following image. I have to disable my checkboxes options as highlighted in the image.

enter image description here

And dialog.xml is like

<stewartOwned jcr:primaryType="cq:Widget"
  defaultValue="false" fieldLabel="Stewart Owned"
  inputValue="false" name="./stewartOwned" type="checkbox"
  xtype="selection" layout="hbox">
    <options jcr:primaryType="cq:WidgetCollection">
        <option1 jcr:primaryType="nt:unstructured" text=""
          value="stewartOwned" />
        <option2 jcr:primaryType="nt:unstructured" text=""
          value="ShowInAdvanced" />
    </options>
    <optionsConfig jcr:primaryType="nt:unstructured"
      width="150" />
</stewartOwned>
<independent jcr:primaryType="cq:Widget"
  defaultValue="false" fieldLabel="Independent" inputValue="false"
  name="./independent" type="checkbox" xtype="selection"
  layout="hbox">
    <options jcr:primaryType="cq:WidgetCollection">
        <option1 jcr:primaryType="nt:unstructured" text=""
          value="I" />
        <option2 jcr:primaryType="nt:unstructured" text=""
          value="ShowInAdvanced" />
    </options>
    <optionsConfig jcr:primaryType="nt:unstructured"
      width="150" />
</independent>

I have tried following solution to disable through id but it is not viable as id is auto generate and you never know what id will be generated in the next session.

listeners jcr:primaryType="nt:unstructured"
    loadcontent="function(dialog) { 
             CQ.Ext.getDom('ext-comp-1568').disabled = 'disabled';
             CQ.Ext.getDom('ext-comp-1573').disabled = 'disabled';
    }" />

Can someone please suggest how I disable highlighted checkboxes in dialog.xml ?


Solution

  • After a lot of research and reading CQ5 documentation, I managed to find out following solution.

    var nameField = 
    dialog.getField('./name').getEl().child('input[value*=ShowInAdvanced]').id;
    CQ.Ext.getDom(nameField).disabled = 'disabled';