-
-
Save nateyolles/e5eed811dc9c35961c23 to your computer and use it in GitHub Desktop.
<!-- Checked checkbox will result in a String property of "true" --> | |
<myCheckbox | |
jcr:primaryType="nt:unstructured" | |
sling:resourceType="granite/ui/components/foundation/form/checkbox" | |
text="My Checkbox" | |
name="./myCheckbox" | |
value="true"/> | |
<!-- Checked checkbox will result in a Boolean property of true--> | |
<myBooleanCheckbox | |
jcr:primaryType="nt:unstructured" | |
sling:resourceType="granite/ui/components/foundation/form/checkbox" | |
text="My Boolean Checkbox" | |
name="./myBooleanCheckbox" | |
value="true"/> | |
<myBooleanCheckboxType | |
jcr:primaryType="nt:unstructured" | |
sling:resourceType="granite/ui/components/foundation/form/hidden" | |
name="./myBooleanCheckbox@TypeHint" | |
value="Boolean"/> | |
<!-- Checkbox defaults to checked and saves a Boolean value of true --> | |
<myCheckbox | |
jcr:primaryType="nt:unstructured" | |
sling:resourceType="granite/ui/components/foundation/form/checkbox" | |
text="My Checkbox" | |
name="./myCheckbox" | |
value="true" | |
checked="true"/> | |
<myCheckboxType | |
jcr:primaryType="nt:unstructured" | |
sling:resourceType="granite/ui/components/foundation/form/hidden" | |
name="./myCheckbox@TypeHint" | |
value="Boolean"/> |
The
uncheckedValue
is working for me on AEM 6.5 inside of a granite/ui/components/coral/foundation/form/multifield. I'm using it to check whether to open a link in a new tab or not. This is what my dialog looks like for the field:<newTab jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/checkbox" text="Open link in new tab" name="./newTab" uncheckedValue="_self" value="_blank" checked="true"/>
Just be sure that
uncheckedValue
does not equal empty string as it won't be stored as a property (the property will just disappear from the node). AEM will check the checkbox if the property doesn't exist. For me this is what was causing the checkboxes to recheck themselves when I subsequently opened the dialog. SettinguncheckedValue
with a value other than""
fixed the issue.
hey there
I am a beginner with AEM 6.5 and I want to implement something as below. Can u help me witht his?
Create dialog box for custom link component s, asking authors to choose if they would like the link to be opened in new tab/windows using checkbox and label
The
uncheckedValue
is working for me on AEM 6.5 inside of a granite/ui/components/coral/foundation/form/multifield. I'm using it to check whether to open a link in a new tab or not. This is what my dialog looks like for the field:Just be sure that
uncheckedValue
does not equal empty string as it won't be stored as a property (the property will just disappear from the node). AEM will check the checkbox if the property doesn't exist. For me this is what was causing the checkboxes to recheck themselves when I subsequently opened the dialog. SettinguncheckedValue
with a value other than""
fixed the issue.