mercredi 31 mai 2017

AEM/CQ: Checkbox is checked saves a Boolean value of TRUE,How to save a Boolean value as FALSE if we Unchecked?

For Example,I have created a check box with below properties

<checkbox1
                    jcr:primaryType="cq:Widget"
                    checked="false"
                    defaultValue="false"
                    fieldLabel="Sample"
                    inputValue="true"
                    name="./sample"
                    checkboxBoolTypeHint="{Boolean}true"
                    type="checkbox"
                    xtype="selection">
                    <listeners
                        jcr:primaryType="nt:unstructured"
                        check="function(isChecked){var panel = this.findParentByType('panel'); var fields = panel.find('name', './sample'); for (var i=0;i&lt;fields.length; i++) {if (fields[i].xtype == 'hidden') { if (isChecked.checked) {fields[i].setDisabled(true);} else {fields[i].setDisabled(false);}}}}"/>

</checkbox1>
<hiddenCheckbox1
                    jcr:primaryType="cq:Widget"
                    disabled="{Boolean}true"
                    ignoreData="{Boolean}true"
                    name="./sample"
                    value="{Boolean}false"
                    xtype="hidden"/>

If we checked/enabled the check box it is showing the property "Sample" like below sample Boolean true (working fine) If we Unchecked/disable the checkbox then it is not showing the property "Sample"

Expectation: I want to show Sample Boolean false if we Unchecked/disable the checkbox




Aucun commentaire:

Enregistrer un commentaire