17th March 2023 at 4:09pm
index
Mode
To use the checkbox widget in index mode set the index
attribute to a property of a DataTiddler. The checked
and unchecked
attributes specify the values to be assigned to the property and correspond to its checked and unchecked states respectively. The default
attribute is used as a fallback value if the property is undefined.
The example below creates a checkbox that is checked if the property in the tiddler ExampleData by the name of the current tiddler is equal to selected
and unchecked if the property is an empty string. If the property is undefined then it defaults to an empty string, meaning the checkbox will be unchecked if the property is missing.
<$checkbox tiddler="ExampleData" index=<<currentTiddler>> checked="selected" unchecked="" default=""> Selected?</$checkbox>
That renders as: