Select widget showing current field value

46 views
Skip to first unread message

JM

unread,
May 22, 2021, 4:16:55 AM5/22/21
to TiddlyWiki

Hi there,

I use a select widget to fill a certain field. I would like to see the current field value - if set - in the dropdown-menu.

Status: <$select field='Status' default='new'>
<option disabled>new</option>
<option>A</option>
<option>B</option>
<option>C</option>
<option>D</option>
</$select>

So now the select widget shows 'new', even, if 'A' is set as field value. Is it possible to show A (if it is set)?

Jens

Eric Shulman

unread,
May 22, 2021, 5:57:53 AM5/22/21
to TiddlyWiki
On Saturday, May 22, 2021 at 1:16:55 AM UTC-7 JM wrote:
Status: <$select field='Status' default='new'>
<option disabled>new</option>
<option>A</option>
<option>B</option>
<option>C</option>
<option>D</option>
</$select>

The $select widget creates a field with the specified name (i.e. "Status").  If you re-display the tiddler *during the current session* , the selected value ("A") will be shown in the $select list, as you expected.  However, all field names *must* be lower case to comply with the HTML syntax used to store them in the file.  So, when you save and reload the file in your browser, the fieldname has been automatically converted to lower case (i.e., "status") and when you then display the tiddler, it will show the default value (i.e., "new"), since the stored tiddler fieldname, "status", no longer matches the specified tiddler fieldname, "Status".

The solution is to always use only lower case field names.

-e

JM

unread,
May 22, 2021, 6:22:33 AM5/22/21
to TiddlyWiki
Well, that solved more than one problem, :-)

Thank you!
Reply all
Reply to author
Forward
0 new messages