mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-11 09:50:27 +00:00
add docs for radio-actions (#5156)
This commit is contained in:
parent
3406b98af6
commit
1de747b182
32
editions/tw5.com/tiddlers/widgets/RadioWidget Example.tid
Normal file
32
editions/tw5.com/tiddlers/widgets/RadioWidget Example.tid
Normal file
@ -0,0 +1,32 @@
|
||||
created: 20201130181015815
|
||||
modified: 20201130183426619
|
||||
tags: RadioWidget
|
||||
title: RadioWidget Example
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\define newText() value: $(actionValue)$
|
||||
|
||||
\define radioActions()
|
||||
<$action-sendmessage $message="tm-notify" $param="RadioWidget ExampleTemplate" value=<<actionValue>> current=<<currentTiddler>> />
|
||||
<$action-createtiddler $basetitle="$:/temp/test/value" $overwrite="yes" text=<<newText>>/>
|
||||
<$action-navigate $to="$:/temp/test/value"/>
|
||||
\end
|
||||
|
||||
!! Using Actions
|
||||
|
||||
If you select an option, the value is written to $:/temp/test/value and the ''id'' field of tiddler: $:/temp/test will be updated.
|
||||
|
||||
A notification showing the ''actionValue'' will be shown.
|
||||
|
||||
<$tiddler tiddler="$:/temp/test">
|
||||
<$radio field="id" value="a" actions=<<radioActions>> > Option a </$radio>|
|
||||
<$radio field="id" value="b" actions=<<radioActions>> > Option b </$radio>|
|
||||
<$radio field="id" value="c" actions=<<radioActions>> > Option c </$radio>|
|
||||
</$tiddler>
|
||||
|
||||
---
|
||||
|
||||
<details>
|
||||
<summary>Show the code [[RadioWidget Example]]</summary>
|
||||
<pre><code><$view mode=text&><pre><code>
|
||||
</details>
|
@ -0,0 +1,7 @@
|
||||
created: 20201130181111808
|
||||
modified: 20201130182421491
|
||||
tags: RadioWidget
|
||||
title: RadioWidget ExampleTemplate
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
value = <<value>>
|
@ -1,6 +1,6 @@
|
||||
caption: radio
|
||||
created: 20131212195353929
|
||||
modified: 20201109091807432
|
||||
modified: 20201130184330254
|
||||
tags: Widgets
|
||||
title: RadioWidget
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -19,6 +19,7 @@ The content of the `<$radio>` widget is displayed within an HTML `<label>` eleme
|
||||
|index|<<.from-version "5.1.14">> The index of the //tiddler// being [[DataTiddler|DataTiddlers]] bound to the radio button<<.tip "takes precedence over //field//">>|
|
||||
|value |The value for the //field// or //index// of the //tiddler//|
|
||||
|class |The CSS classes assigned to the label around the radio button<$macrocall $name=".tip" _="""<<.from-version "5.1.14">> `tc-radio` is always applied by default, as well as `tc-radio-selected` when selected"""/>|
|
||||
|actions|<<.from-version "5.1.23">> Optional, A string containing ActionWidgets to be triggered when the value changes. <br>The variable: ''actionValue'' is available for the actions. |
|
||||
|disabled|<<.from-version "5.1.23">> Optional, disables the radio input if set to "yes". Defaults to "no"|
|
||||
|
||||
|
||||
@ -39,3 +40,5 @@ This example sets the `Tree Frog` index in the tiddler AnimalColours:
|
||||
<$radio index="Tree Frog" value="green"> green</$radio>
|
||||
<$radio index="Tree Frog" value="brown"> brown</$radio>
|
||||
</$tiddler>"""/>
|
||||
|
||||
{{RadioWidget Example}}
|
Loading…
Reference in New Issue
Block a user