Get field from a selected tiddler

65 views
Skip to first unread message

Vulcanior

unread,
May 2, 2017, 8:11:02 AM5/2/17
to TiddlyWiki
Hey !

I'm trying to create a character sheet builder. I generate a select for available races :

<$select tiddler='$:/player-race' default='Carbonique'>
  <$list filter='[tag[Races]]'>
    <optgroup label={{!!group}}>
      <$list filter='[tag[Races]group{!!group}]'>
          <option value={{!!title}} title={{!!text}} ><$view field='title'/> (<$view field='cost'/>)</option>
      </$list>
    </optgroup>
  </$list>
</$select>

Now, I want to get the field "cost" of the selected race/tiddler in a <progress> (or <meter>) html tag, but this don't work :

<progress max='2' value={{$:/player-race!!cost}} ><$view tiddler={{$:/player-race}} field='cost' /></progress>

Anyone have a idea to get this work ?

Jed Carty

unread,
May 2, 2017, 8:45:57 AM5/2/17
to TiddlyWiki
The progress bar thing you have is looking at the cost field of the tiddler $:/player-race, not the cost field of the tiddler listed in player race.

The easiest way to get around that is to use this:

<$tiddler tiddler={{$:/player-race}}>
<progress max='2' value={{!!cost}} ><$view field='cost' /></progress>
</$tiddler>

Vulcanior

unread,
May 2, 2017, 9:02:11 AM5/2/17
to TiddlyWiki
It's works ! Thank you !
Reply all
Reply to author
Forward
0 new messages