17th March 2023 at 4:11pm
field
Mode
Using the checkbox widget in field mode requires the field
attribute to specify the name of the field. The checked
and unchecked
attributes specify the values to be assigned to the field to correspond to its checked and unchecked states respectively. The default
attribute is used as a fallback value if the field is missing or contains a value that does not correspond to the value of the checked
or unchecked
attributes.
This example creates a checkbox that is checked if the field status
is equal to open
and unchecked if the field is equal to closed
. If the field value is undefined then it defaults to closed
.
<$checkbox field="status" checked="open" unchecked="closed" default="closed"> Is it open?</$checkbox>
''status:'' {{!!status}}
That renders as:
status: