Is it possible to trigger an action with the radio widget?

151 views
Skip to first unread message

si

unread,
Apr 17, 2020, 8:32:44 AM4/17/20
to tiddl...@googlegroups.com
I can't find anything documented, but I wondered if there is a workaround?

I'm specifically trying to set a timestamp every time I use the radio widget to change the value of a field.

The only thing I can think of currently is to create my own radio widget functionality with buttons and the reveal widget. Maybe there is an easier solution?

Mat

unread,
Apr 17, 2020, 9:24:01 AM4/17/20
to TiddlyWiki
For one thing, you can style a button to appear like a radio widget. 

(...now, didn't I create a plugin or something like this less than two weeks ago??? Where's my glasses. Besides, did I have breakfast today? Hello? Are you saying Obama is not president anymore? Who?)

<:-)

Mat

unread,
Apr 17, 2020, 9:30:30 AM4/17/20
to TiddlyWiki
Ah, yes, I was thinking of http://tabber.tiddlyspot.com/ which styles buttons to appear like tabs. They could just as well be styled to appear like radio buttons. 

And my glasses are on my nose, I had a sandwich and coffee for breakfast and obviously Trump is president. He beat Thatcher by a hair's margin.

<:-)

Eric Shulman

unread,
Apr 17, 2020, 10:53:05 AM4/17/20
to tiddl...@googlegroups.com
On Friday, April 17, 2020 at 5:32:44 AM UTC-7, si wrote:
I'm specifically trying to set a timestamp every time I use the radio widget to change the value of a field.
The only thing I can think of currently is to create my own radio widget functionality with buttons and the reveal widget. Maybe there is an easier solution?

You do need to use a $button widget, but don't need to use the $reveal widget.  Here's a working example (tested on TiddlyWiki.com)
\define set_timestamp() <$action-setfield timestamp=<<now YYYY0MM0DD0hh0mm0ss0XXX>> />

<$button class="tc-btn-invisible" actions=<<set_timestamp>>>
   <$radio field="choice" value="one"> one </$radio>
   <$radio field="choice" value="two"> two</$radio>
   <$radio field="choice" value="three"> three </$radio>
</$button>

choice = {{!!choice}}, timestamp = {{!!timestamp}}
The $radio widgets show/set the current choice, but the timestamp is set by the surrounding $button widget.

Let me know how it goes.

enjoy,
-e

note: edited to simplify the code even further

si

unread,
Apr 17, 2020, 12:56:57 PM4/17/20
to TiddlyWiki
@mat Thanks that's a nice plugin idea, I may well steal it for my wiki

@Eric Thanks a lot Eric, I didn't realize you could could do that! Exactly what I need.

TonyM

unread,
Apr 20, 2020, 10:41:05 PM4/20/20
to TiddlyWiki
Cool solution Eric!

A Gloom

unread,
Apr 21, 2020, 1:27:35 AM4/21/20
to TiddlyWiki
This case and solutions illustrates the flexibilty (hackability) that TW offers over other apps-- I see countless applicatins of both approaches.

Thatcher for 2020!1!

TonyM

unread,
Apr 21, 2020, 2:05:16 AM4/21/20
to TiddlyWiki
Eric,

This intriguing example of yours begs the Question is the button widget effectively acting as if it were onclick in html for the three radio buttons within it? and thus any radio button triggers the named actions=

It makes me think we may be able to use this more extensively, ideally to leverage html forms and other code out their, and if perhaps we had the ability for an action to be a php/html put and get etc... 

Why?
I am convinced just beyond my level of skill there is a way to use a html form built into tiddlywiki to allow login (on a php server) and checkout a tiddlywiki for edit, if not already, then a check back in. This would allow for serial edits of a tiddlywiki, a poor man's alternative to a multi-user environment.

Regards
Tony

Mat

unread,
Apr 21, 2020, 5:46:32 AM4/21/20
to TiddlyWiki
TonyM wrote:
This intriguing example of yours begs the Question is the button widget effectively acting as if it were onclick in html for the three radio buttons within it? and thus any radio button triggers the named actions=

As far as I understand: yes. You can "nest" things in buttons so whatever "command" you click inside a button also clicks the button. (But it seems you cannot nest buttons in buttons; clicking the inner does not also trigger the outer.)
Actually this happens with links too: <$link to=foo>Go to foo or to CamelCase</$link> (...which IMO is not desired).

<:-)

Mohammad

unread,
Apr 23, 2020, 9:34:51 AM4/23/20
to TiddlyWiki
Added to TW-Scripts
Reply all
Reply to author
Forward
0 new messages