Select a value from the xtype type selection type. Cq5

Hello, I have a problem. I would like to set the state of the checkbox: checked, but I could not make 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"> 

I tried to do this: Set the default checkbox in CQ5

but this did not solve the problem.

+2
source share
3 answers

This is an example of what I used to set the default value for the checked field as the default. Pay attention to defaultValue="true"

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

Try writing it this way.

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

the problem you're talking about is creating a checkbox using js / json. if you look at what is actually stored in the JCR, you will see that the value against the checkbox is actually not a boolean, but a string. which can be true / flase or on / off if the item is inside the checkbox group.

In your case, to make it automatically checked in your dialog.xml file, you need to use checked = "true".

0
source

All Articles