dialog I add checkout ,I expect to have initial values when the component is not edited
<boutiqueCheckout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/checkbox"
uncheckedValue="true"
name="./boutiqueCheckout"
text="Open in new window"
value="{Boolean}false"/>
html 中我打印
<div>232323========${properties.boutiqueCheckout}</div>
Output results on the final page
<div>232323========</div>
How should I renovate it,
Solved! Go to Solution.
Views
Replies
Total Likes
There is a possible way to have default values for the component through template.
Go to the template in the initial content xml add the component's default value
<jcr:content>
<root>
</root>
</jcr:content>
Hello @guodongha ,
The checkbox value isn’t stored until the dialog is saved, so properties.boutiqueCheckout is null initially.
fix:
Use a default value in HTL to handle unedited components:
<div>232323========${properties.boutiqueCheckout @ context='boolean', default=false}</div>
-> This ensures it prints false by default (and true once the author checks it and saves).
There is a possible way to have default values for the component through template.
Go to the template in the initial content xml add the component's default value
<jcr:content>
<root>
</root>
</jcr:content>
Views
Like
Replies