Select Widget - Printing the user's selection

This code here prints the user’s selection wonderfully & simply.

<$select tiddler='$journal.entry.new' field='transaction.entry.ledger.id.debit'>
<option value='cities'>A Tale of Two Cities</option>
<option value='science'>A New Kind of Science</option>
<option value='dice'>The Dice Man</option>
</$select>

{{$journal.entry.new!!transaction.entry.ledger.id.debit}}

Should one try to use a list filter for the option values suddenly tiddlywiki becomes reluctant to print the selection.

<$select tiddler='$journal.entry.new' field='transaction.entry.ledger.id.debit'>
<$list filter="[data[ledger]]">
<option value={{!!ledger.id}}><$view field='ledger.title'/></option>
</$list>
</$select>

{{$journal.entry.new!!transaction.entry.ledger.id.debit}}

You would figure if the first snippet works why wouldn’t a listed syntax work as well!?

what am i doing wrong?

Hi,

Replacing your filters and fields with constants in a simple example does work, so I guess the problem doesn’t come from the list widget.

<$select tiddler='$journal.entry.new' field='transaction.entry.ledger.id.debit'>
<$list filter="[[A]] [[B]] [[C]]">
<option value=<<currentTiddler>>><$view field="title"/></option>
</$list>
</$select>

{{$journal.entry.new!!transaction.entry.ledger.id.debit}}

Fred

Hey Fred I solved it! I don’t understand why it works but apparently if you place $ in front of value $value={{!!ledger.id}} it carries the data over.

<$select tiddler='$journal.entry.new' field='transaction.entry.ledger.id.debit'>
<$list filter="[data[ledger]]">
<option $value={{!!ledger.id}}><$view field='ledger.title'/></option>
</$list>
</$select>

{{$journal.entry.new!!transaction.entry.ledger.id.debit}}

thanks for brain storming with me, i appreciate you.

Creating example “ledger” tiddlers on tiddlywiki.com with data, ledger.id and ledger.title fields just works with your code “as is”… So I guess it doesn’t produce the outcome you expected.

What your code does is display the ledger.title field content, but store the ledger.id field content in the result tiddler $journal.entry.new!!transaction.entry.ledger.id.debit.

Changing value=... to $value=... replaces the legit value attribute with a custom and useless $value attribute, which in turn stores ledger.title in the result tiddler instead of ledger.id.

So I guess what you wanted is the title as a result, not the id… and you can get this by removing the $value or value attribute altogether.

Fred

So I guess it doesn’t produce the outcome you expected.

You are right and I am removing the resolved status :weary:

what you wanted is the title as a result, not the id…

No, unfortunately that wasn’t what I wanted. I wanted to show the ledger.title and use the ledger.id as its value.

What your code does is display the ledger.title field content, but store the ledger.id field content in the result tiddler $journal.entry.new!!transaction.entry.ledger.id.debit .

Which means my original syntax was correct and I am back to square one again with the non printing issue. :confused:

Is your wiki available online? Or perhaps you could export a few “ledger” tiddlers and the tiddler containing the code, and post them here?
I fear I won’t be able to help more without these…

Fred