[TW5] Resuseable person field drop-down list

80 views
Skip to first unread message

Matthew Petty

unread,
Mar 24, 2016, 5:54:54 AM3/24/16
to TiddlyWiki
I have tiddlers tagged "person", and a subset of those tagged "family". I want to create a drop-down list of the family people which would set the field "person" of the current tiddler to the title of the person tiddler.
That's easy to do once:

<$select field="person" default="">
<$list filter="[tag[person]tag[family]]">
<option>{{!!title}}</option>
</$list>
</$select>

It would be very nice to be able to put the above in a separate tiddler, called "Family Dropdown", and then transclude that whenever I need it (I want it in multiple places).

But when I tried just copying the code to "Family Dropdown" and transcluding it, the only the person field of "Family Dropdown" was changed, not the field in the current tiddler.

How can I fix that?

Eric Shulman

unread,
Mar 24, 2016, 6:19:14 AM3/24/16
to TiddlyWiki
On Thursday, March 24, 2016 at 2:54:54 AM UTC-7, Matthew Petty wrote:
But when I tried just copying the code to "Family Dropdown" and transcluding it, the only the person field of "Family Dropdown" was changed, not the field in the current tiddler.

use "template transclusion", like this:

{{||FamilyDropdown}}

This will transclude the content from FamilyDropdown, but use the current tiddler for the data context.  Thus, field references in FamilyDropdown will modify values in the current tiddler.  Q.E.D.

Note: the full transclusion syntax is: {{ContextTiddler||TemplateTiddler}}, where ContextTiddler is the source of the data, and TemplateTiddler is the source for the output format.  In the above example, {{||FamilyDropdown}}, omitting the ContextTiddler implies the current tiddler by default.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
InsideTiddlyWiki: The Missing Manuals

Matthew Petty

unread,
Mar 24, 2016, 7:51:00 AM3/24/16
to TiddlyWiki
That's a bingo! Thanks very much - that's useful for so many things.

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/tbAPdS5c9Rs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/f34c7527-951f-4ae6-9201-fd394173b1a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages