TW5 - I have no idea where i went wrong.

62 views
Skip to first unread message

myst...@gmail.com

unread,
Jun 28, 2017, 7:00:28 PM6/28/17
to TiddlyWiki
I Have a templated form for a gaming group i'm with.
and i SWEAR it was working right, but now...

The problem:
I have a tiddler  w/ transcludes a template that has macro calls in it.

When i use the macros to save/edit fields on the tiddler, it is SUPPOSED to be saving the data to $:/Data/$(currentTiddler)$
Which in my mind shoudl be '$:/Data/My Character.
What is happening is the data is being ssaved to $:/Data/$:/Template/CharacterSheet !!

Does anyone have an idea why i'm resolving $(currentTiddler)$ as the transcluded template instead of the Active Tiddler?
Any help, much appreciated.  Below i spell out a lil better the layout.

The layout is:

1 style tid:         $:/Style/CharacterSheet
Contains CSS.

1 template tid:   $:/Template/CharacterSheet
Contains HTML and macro calls like the following:

<span class="row full">
  <fieldset class="charsheet">
    <legend>Notes</legend>
    <div class="row">
      <<e_button e_notes>>
    </div>
    <div class="row">
      <<text_box notes 120 e_notes>>  
    </div>
  </fieldset>
</span>

1 macro tid:       $:/Macros/CharacterSheet
Tagged: $:/tags/Macro
Contains various macros for swapping between display and edit fields. like this one:
\define text_box(field:nofield size:100 check:nocheck)
<$reveal type="match" state="!!$check$" text="edit">
<$edit-text  tiddler="$:/Data/$(currentTiddler)$" index="$field$" size="$size$" tag="textarea" />
</$reveal>
<$reveal type="nomatch" state="!!$check$" text="edit" >
  <$transclude tiddler="$:/Data/$(currentTiddler)$" index="$field$" mode="block"/>
</$reveal>
\end

1 tiddler: "My Character"
contains:
     {{$:/Template/CharacterSheet}}
and several fields like:
    e_notes: 'display' or 'edit'  (used to toggle display/edit fields)



Eric Shulman

unread,
Jun 28, 2017, 7:52:23 PM6/28/17
to TiddlyWiki
On Wednesday, June 28, 2017 at 4:00:28 PM UTC-7, myst...@gmail.com wrote:
I Have a templated form for a gaming group i'm with.
and i SWEAR it was working right, but now...

The problem:
I have a tiddler  w/ transcludes a template that has macro calls in it.

What syntax are you using to transclude the template?

   {{$:/Template/CharacterSheet}}
is used to transclude a tiddler where both the field values and formatting (text field content) are defined in the same tiddler.

However, if you use
   {{SomeTiddler||$:/Template/CharacterSheet}}
then the field values come from "SomeTiddler", but the formatting comes from the "$:/Template/CharacterSheet" template.

... and, if you omit the "SomeTiddler" (but LEAVE the "||" syntax), like this:
   {{||$:/Template/CharacterSheet}}
then the *current tiddler* is used as the data source with the formatting from the "$:/Template/CharacterSheet" template.

For more details, see:

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas" (tm)
InsideTiddlyWiki: The Missing Manuals

Message has been deleted

myst...@gmail.com

unread,
Jun 28, 2017, 7:57:08 PM6/28/17
to TiddlyWiki
Thanks Eric.
I was looking at 'Transcluding with Templates' for like the 5th time, and it smacked me in the face.
It was indeed the lack of '||' before the template tiddler.
Such a small change, so easy to overlook time after time when debugging.
Reply all
Reply to author
Forward
0 new messages