Is there a way to make a Radio Button create a tag? TW5

168 views
Skip to first unread message

Aaron Haslem

unread,
Jun 1, 2017, 11:31:11 PM6/1/17
to TiddlyWiki
Greetings,
This is my first post to this group.  I only recently found TW and I am finding it to be an incredible tool for creating a dynamic map of a system I work with.

Here's the question: We have several hundred units that are all very similar in type and function that are assigned to different locations.  I want users to be able to create a new tiddler based off of a template.  I am using tabs within a basic tiddler to display the detailed information...
Anyhow, I am using the Radio widget to list options for each unit.  For example: a unit can be assigned to Box 1, Box 2, Box, 3, Box 4 or Box 5,  but only 1 box and if it is assigned to a box it can't be assigned to any of the other boxes...a Radio Button.  The widget works great.

But, I also use the tags of a unit in another tiddler to list all of the units that are in a particular box.  If I have 50 units that users have used the radio buttons to say those units are in  Box 1, I then use a tag on that unit to list in another Tiddler called Box 1...

What I would like to do is, if a user selects Box 1 in the Radio Buttons, the action would also create a tag for that unit that indicates the tiddler is associated with Box 1. 

I get it to work with the checkbox widget:
<$checkbox  field="box" checked='[[Box 1]]' tag="Box 1"> Box 1</$checkbox>
The tag gets added to the tiddler when the box is checked but, this means that a user can check all available boxes.

The radio button allows me to limit them to only selecting one box.  I tried this:
<$radio field="box" value='Box 1' tag="Box 1"> Box 1</$radio>
<$radio field="box" value='Box 2' tag="Box 2"> Box 2</$radio>

The field is filling in correctly, but I can't figure out how to get it to create a tag when the button is selected.

Is there a way to get the radio widget to create a tag?

Mark S.

unread,
Jun 2, 2017, 9:56:04 AM6/2/17
to TiddlyWiki
Hello Aaron,

Unless things have changed (and not been documented) you can't do that with radio buttons. But there's ways to make a regular button that looks like a radio button. See the post

"How do I create two fields at once with one radio button?"

Scroll to the end. I think Matabele's solution might do what you want.

Good luck,
Mark

c pa

unread,
Jun 2, 2017, 5:29:06 PM6/2/17
to TiddlyWiki
Aaron,

You can do it this way if there is only one tag at a time on the tiddler you are tagging - Switches the tags between Jane and Joe Bloggs

<$radio tiddler="test" field="tags" value="JoeBloggs">
Joe Bloggs
</$radio>
<$radio tiddler="test" field="tags" value="JaneBloggs">
Jane Bloggs
</$radio>

The other standard method is to use $reveal and buttons and images to simulate radio buttons.
Since Radio buttons assume that there is only one value being set at a time . . . the code above may be for what you are looking

Jed Carty

unread,
Jun 3, 2017, 3:33:30 AM6/3/17
to TiddlyWiki
The wiki update mechanism makes it difficult to make some widgets trigger action widgets to make something like this work well. I have a demo around somewhere but using what I made is a bad idea because there may be unnoticed problems with it.

My suggestion is to use fields instead of tags, and have the radio button set the value of a box field and use that instead of tags.

Aaron Haslem

unread,
Jun 3, 2017, 12:46:48 PM6/3/17
to tiddl...@googlegroups.com
Thanks c pa.  I will give this a try.  However my tiddlers typically have at the least 3-4 tags, I only have 1 or 2 with only 1 tag.  If this wipes out the other tags by setting the tags value to only one tag, it may not work.

Aaron Haslem

unread,
Jun 3, 2017, 12:53:21 PM6/3/17
to TiddlyWiki
Jed,
Here is where I expose more of my ignorance to TW.  I found that creating lists and tables according to tags to be fairly simple. I can remember how I am organizing the information fairly simple through knowing the tag, and, the syntax for creating  filter according to tags is fairly straight forward.

What is the syntax for structuring a filter according to fields?

filter=[tag[... with the AND, OR, NOT structure is pretty easy to understand and write out.  How do I set up a filter to pull information based on if a field of a tiddler equals xyz?
filter=[field={{!!..}}="xyz"!field ???  I have not looked into how to setup and the syntax for filtering based on a field being equal to specific text or data.

Mark S.

unread,
Jun 3, 2017, 3:41:54 PM6/3/17
to TiddlyWiki
[myfield[xyz]]  and [field:myfield[xyz]] should get you there (or close).

See http://tiddlywiki.com/#field%20Operator

"Filter Operators" is a good place to start to learn more about filters and see what filters are available.

Good luck!
Mark

Mark S.

unread,
Jun 3, 2017, 3:50:53 PM6/3/17
to TiddlyWiki
The other way to do this is to have the radio button make the selection for you, and then an actual button to apply the change. If you think about it, this is the way things work on most forms you fill out on websites. You make various types of selections, but nothing happens until you hit submit.

Good luck
Mark

Aaron Haslem

unread,
Jun 3, 2017, 9:43:05 PM6/3/17
to TiddlyWiki
Thanks gents,
Using the RadioWidget to fill in a field and then filtering by field is getting the effect I want.
Reply all
Reply to author
Forward
0 new messages