How to choose field value by drop-down list on template?

45 views
Skip to first unread message

yasai ya

unread,
Dec 19, 2022, 9:39:09 AM12/19/22
to TiddlyWiki
Dear, everyone.
I wounder to use TW5 as database, and I am making editor template.

I want to choose field value with drop-down list.
Could anyone tell me how to make it for template?

<$select field="LowVoltage">
<$list filter="[title[$:/Ship/LowVoltage]get[text]split[,]]">
<option value=<<currentTiddler>>><$view field='title'/></option>
</$list>
</$select>


*I made editor for the tiddler, however It need setting one by one.
*My goal is without HTML  the basic operations are, so I separate choices to another tiddler "$:/Ship/LowVoltage".


Attached .tid file

editDataBaseEntry.tid
*It is editor template.
*I am a beginner of HTML. Sorry if it is elementary thing.
*TW5 let me start learning HTML. Thanks for the opportunity to grow!

<table>
<$list filter="[is[current]fields[]] -creator -created -text -title -modified -modifier -color -tags -list" variable="fieldName">
        <tr>
        <td> <<fieldName>> </td>
            <td> <$edit field=<<fieldName>>/> </td>
        </tr>
</$list>
</table>

field:<$edit tiddler="$:/temp/editDataBaseEntry" field="Edit-field"/>
<$fieldmangler>
<$button>
<$action-setfield $field={{$:/temp/editDataBaseEntry!!Edit-field}} $value="default" />
Add
</$button>
</$fieldmangler>
/
<$button>
<$action-confirm $message="Do you wish to delete the field?">
<$action-deletefield $field={{$:/temp/editDataBaseEntry!!Edit-field}} />
Delete
</$action-confirm>
</$button>

Product_11036_edit.tid
*It is data base tiddler. The datas on each fields.

Product_11036.tid
*Just show with edit template.
text:{{Product/11036||editDataBaseEntry}}
Product_11036_edit.tid
Product_11036.tid
editDataBaseEntry.tid

yasai ya

unread,
Dec 20, 2022, 12:42:47 AM12/20/22
to TiddlyWiki
Almost there!
I got pull-down list. Next I need it to indicate current value.

↓revised editDataBaseEntry.tid
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 <table>
        <$list filter="[is[current]fields[]] -creator -created -text -title -modified -modifier -color -tags -list" variable="fieldName">
        <tr>
        <td> <<fieldName>> </td>
        <td>
                <$select field="<<fieldName>>" tooltip="">
                <$list filter="[<fieldName>] +[addprefix[Product/]]">
                <$list filter="[<currentTiddler>] +[get[text]split[,]]">
                <option value=<<currentTiddler>>> <$view field='title'/></option>
                </$list></$list>
                </$select>
        </td>
        </tr>
        </$list>
</table>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2022年12月19日月曜日 23:39:09 UTC+9 yasai ya:

yasai ya

unread,
Dec 20, 2022, 6:49:04 AM12/20/22
to TiddlyWiki
<$list filter="[<fieldName>] +[addprefix[Product/]]">
 <$list filter="[<currentTiddler>] +[get[text]split[,]]">
<$list filter="[<fieldName>] +[addprefix[Product/]] +[get[text]split[,]]">
2022年12月20日火曜日 14:42:47 UTC+9 yasai ya:
Reply all
Reply to author
Forward
0 new messages