From 94d460ef20a8d6f1633c51afc24117ba4d88d5c6 Mon Sep 17 00:00:00 2001 From: Marxsal Date: Fri, 30 Dec 2016 09:46:48 -0800 Subject: [PATCH] CheckboxWidget actions documentation (#2673) * Add example of how to use action parameter in Checkbox Widget * Doc: CheckboxWidget actions --- .../tw5.com/tiddlers/widgets/CheckboxWidget.tid | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/editions/tw5.com/tiddlers/widgets/CheckboxWidget.tid b/editions/tw5.com/tiddlers/widgets/CheckboxWidget.tid index 4505c93c9..f7820871f 100644 --- a/editions/tw5.com/tiddlers/widgets/CheckboxWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/CheckboxWidget.tid @@ -1,6 +1,6 @@ caption: checkbox created: 20131024141900000 -modified: 20161126081845399 +modified: 20161221202816730 tags: Widgets title: CheckboxWidget type: text/vnd.tiddlywiki @@ -51,3 +51,16 @@ To use the checkbox widget in index mode set the ''index'' attribute to the inde The example below creates a checkbox that is checked if the index by the name of this tiddler in the tiddler ExampleData is equal to ''selected'' and unchecked if the index is an empty string. If the index is undefined then it defaults to an empty string, meaning the checkbox will be unchecked if the index is missing. <$macrocall $name="wikitext-example-without-html" src="""<$checkbox tiddler="ExampleData" index=<> checked="selected" unchecked="" default=""> Selected?"""/> + +!! Actions parameter + +The `actions` parameter here uses both the [[Action Set Field Widget|ActionSetFieldWidget]] and [[Action Send Message Widget|ActionSendMessageWidget]] to demonstrate two actions. The [[Set Widget|SetWidget]] uses a filter value to set the value of variable `tag`. The [[Action Send Message Widget|ActionSendMessageWidget]] joins all the tags into one large tag. The [[Action Set Field Widget|ActionSetFieldWidget]] appends the tags as individual tags. In this example, the [[Field Mangler Widget|FieldManglerWidget]] is required for the [[Action Send Message Widget|ActionSendMessageWidget]] but not for [[Action Set Field Widget|ActionSetFieldWidget]]. Be aware that the action occurs whether you check or uncheck. Surrounding the `actions` attribute string with triple quotes may be necessary. + +<$macrocall $name='wikitext-example-without-html' src='<$fieldmangler> +<$set filter="[[Features]] [[Encryption]] +[tags[]]" name="tag"> +<$checkbox actions="""<$action-setfield $field="tags" $value=<> /><$action-sendmessage $message="tm-add-tag" $param=<> />""" field="checked" checked="YES" unchecked="NO" > + Add tags from tiddlers [[Features]] and [[Encryption]] + + +' /> +