Help needed for Tag Picker Transclusion

I would like to use This solution for a Tag Picker by @telumire in my wikis, but I can’t get it to work in any tiddlers other than the original tiddler. I would like the tag picker to work in any currentTiddler without using a specifically tagged tiddler (using a viewtemplate).
Can you help me please a demo can be seen here.

@Sunny I just had a quick look, and whilst I find the solution interesting I am not sure what is intended by the solution existing in the demo tiddler.

Try this and the functionality is mostly there {{||Tag picker with custom list of tags}} ie transclude as template on current tiddler.

Hello @TW_Tones,
Thanks for offering a solution, but I should have mentioned that I already tried your method and I also tried tagging the Tiddler with $:/tags/ViewTemplate, which did not work either.

How it should work
The picker should only offer the tag names listed in the tagListFilter field when the dropdown ‘V’ is used. (+A B C)
The status of the tagListFilter field (+A B C) is also shown in the main edit textarea and typing new tag names edits the tagListFilter field and updates the dropdown selection.

New (extra / additional tags eg private) can be added to the tiddler by typing into the text box with the placeholder tag/name, these stay separate from the tagListFilter tags.
Transcluding as a Template does not add tags to the currentTiddler.
I hope this gives an adequate description of the intended usage.

There are several examples at: https://tiddlywiki.com/#tag-picker%20Macro%20(Examples)

The last example:

  • Allows you to populate $:/temp/test/tag-picker field: foo source with values
  • If a value is selected, field: bar will get that value
  • the <<addNewTagToSource>> procedure will also add tags entered by hand to the foo field

If you do not want to add new tags to the foo filed you need to use the last but one example.

  • I uses source field foo to add tags to bar
  • tags added by hand are not added to foo

Sorry for the shitty “foo bar” field names, but if someone can give me better field names that fit the examples, I’ll be happy to change the docs.

Hello @pmario
I have also tried these examples and couldn’t get them to work.
Maybe just me being stupid, but why is it so complicated to adapt the original example shown to just work wth specific or all tiddlers, out of the box.

Update
Using your last example on tiddlywiki.com , does work.
example1.json (1.0 KB)

I just need to modify it for @telumire’s example

The example you linked is from Jan. 2023. I did completely rewrite the tag-picker code in March 2024. So everything in the example that modifies or overwrites tag-picker code has to fail.

There should be no need to modify the tag-picker procedures. I need to have a closer look a the example, to understand what it does.

Thats simple, Use examples like “fieldname”, “alt-tagfield” “user-tag”, “$:/system-tag” etc… and if you must use the foo bar, which I am not in favor of use foo-field, bar-tag etc…

Something about your description confuses me, and trying to answer your questions by the reference to another solution, the reference to telumire’s solution adds to this complexity.

Simple example

\function custom.tags() A B C +[format:titlelist[]join[ ]]
<$macrocall $name=tag-picker tagField=alt-tag tagListFilter=<<custom.tags>> />

Perhaps this is missstated, what you are realy saying is something like;

  • Once a tag selected from the dropdown, no longer show it in the drop down as on telmire’s example and how normal tags work (not editing the filter but changing the result?)
\function custom.tags() A B C -[enlist{!!alt-tag}] +[format:titlelist[]join[ ]]
<$macrocall $name=tag-picker tagField=alt-tag tagListFilter=<<custom.tags>>/>
<$list filter="[enlist{!!alt-tag}sort[]]" join=&nbsp; ><<tag>></$list>

Of course you can change this to the tags field

\function custom.tags() A B C -[enlist{!!tags}] +[format:titlelist[]join[ ]]

<$macrocall $name=tag-picker tagField=tags tagListFilter=<<custom.tags>>/>
<$list filter="[enlist{!!tags}sort[]]" join=&nbsp; ><<tag>></$list>

Of note,

I display the current select tags using the tag macro, however I am not provisioning a way to remove a tag. If you have my reimagin tags solution installed you can remove the tag from the tag pill dropdown.

@Sunny Are there any gaps in meeting your requirements now?

I am sorry, I didn’t know that the tag-picker code had been re-written.
That explains why I was having so much trouble getting it to work.

1 Like

Hi @TW_Tones
thanks for providing the new function.

Yes that’s right.
I tried your examples on Tiddlywiki.com v5.3.8 and they work.
However when I copy the same tiddlers to my own wiki v5.3.6 they show all tags in the dropdown.
I will try them with v5.3.8
Removal of the tags would be needed. I have found reimagin tags on this discussion, are they the current version?

Hello @TW_Tones
I have tried your function on an empty TW version 5.3.8 and it works great.

No, you have solved this issue for me with your custom tags function and your reimagin tags package, which allows the removal of any tags and completes my needs.

Thanks again for helping and my apologies for the confusion I cccccused.
I am sure this solution will be very helpful to a lot of people on this forum.

Thanks @pmario for your help and the link to the new tag-picker macro examples.

Don’t be sorry. … We can not know everything.

The tag-picker macro got a tagField parameter with v5.1.23 in 2020. So it was intended to be possible to user other fields. But the change was not complete enough.

For v5.3.4 I did the rewrite to add the target tiddler and the tagListFilter parameters. With those changes in place it should now be possible to use the UI for any field, without the need to modify the macro itself.

I did add some new examples too, but it seems they are still a bit too weird. I did create a GH issue: [DOCS] Improve tag-picker Examples · Issue #9232 · TiddlyWiki/TiddlyWiki5 · GitHub so we do not forget about it.

1 Like

Ha, Yes this occured because I went back to tiddlywiki.com to confirm the syntax and thus saw the new syntax. There does seem to be different behaviours I am yet to pin down.