checkout No default value | Community
Skip to main content
Level 2
November 3, 2025
Question

checkout No default value

  • November 3, 2025
  • 2 replies
  • 215 views

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,

2 replies

ManviSharma
Adobe Employee
Adobe Employee
November 3, 2025

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).



donquixote_dofl
Level 2
November 3, 2025

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>

<boutiqueCheckoutComponent
            jcr:primaryType="nt:unstructured"
            boutiqueCheckout="true"/>

</root>

</jcr:content>