mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-08-24 10:36:50 +00:00
![jeremy@jermolene.com](/assets/img/avatar_default.png)
@pmario we avoid using the details element because it doesn't remember its state across refreshes. It's not something that we should encourage people to use if they don't understand the limitations. I also simplified the radio widget example because putting all the options on one line with a vertical bar separator is not a common way to display radio buttons.
36 lines
1.1 KiB
Plaintext
36 lines
1.1 KiB
Plaintext
created: 20201130181015815
|
|
modified: 20210307102027763
|
|
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
|
|
|
|
When you select an option below the following acitons will occur:
|
|
|
|
* the value is written to $:/temp/test/value
|
|
* 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>
|
|
|
|
The wikitext of this example is shown below:
|
|
|
|
<$codeblock code={{RadioWidget Example!!text}}/>
|