How to add a tag to a tiddler via a SelectWidget?

102 views
Skip to first unread message

LDL

unread,
Apr 14, 2018, 7:28:49 AM4/14/18
to TiddlyWiki
Hello everyone,
I would like to add a tag to the current tiddler via a SelectWidget that offers a filtered list of tags/tiddlers.

The filter selects all the tiddlers tagged with "prj" and I would like the current tiddler to be tagged with the selected item (one of the tiddlers tagged with "prj")

The solution I've come up so far is the following:

<$select  field='tags'>
<$list filter='[tag[prj]]'>
<option><$view field='title'/></option>
</$list>
</$select>

My current problem with this solutions is that all the tags are removed and substituted with the one derived from the SelectWidget. I would like, instead, to retain all the existing tag and just add the selection from the SelectWidget to the tags.

Any idea on how to achieve the desired behavior?

Thanks,
Lorenzo

Jed Carty

unread,
Apr 14, 2018, 8:40:20 AM4/14/18
to TiddlyWiki
I have worked on this a bit before but I don't think I ever got a good solution. Doing it in two steps works but it isn't quite as nice to use.

The widgets I made are available here, but I haven't tested them a lot.



if you want to do two steps it is like this (select the tag from the select and then click the button to add it):

<$select  tiddler='$:/temp/AddTag/tags' field='text'>
<$list filter='[tag[prj]]'>
<option><$view field='title'/></option>

</$list>
</$select><$fieldmangler> <$button>Add tag<$action-sendmessage $message='tm-add-tag' $param={{$:/temp/AddTag/tags}}/></$button></$fieldmangler>

LDL

unread,
Apr 14, 2018, 10:02:33 AM4/14/18
to TiddlyWiki
Thank you Jed,
doing it in two steps is fine for my purposes and works as expected, but I'll explore also your widgets.

Best wishes,
Lorenzo

Matthew Lauber

unread,
Apr 17, 2018, 10:58:36 AM4/17/18
to TiddlyWiki
Something you can consider is using the multiple flag on your select ala

<$select multiple field='tags'>
<$list filter='[tag[prj]]'>
<option><$view field='title'/></option>
</$list>
</$select>

This will render as a multiple select with the already present tags highlighted.  You can add or remove tags by using the standard ctrl-click to select an additional item.  

LDL

unread,
Apr 19, 2018, 1:27:36 PM4/19/18
to TiddlyWiki
Thank you Matthew,
that's a nice solution as well!
Reply all
Reply to author
Forward
0 new messages