Dropdown that triggers a field update when selected?

78 views
Skip to first unread message

leeand00

unread,
Oct 24, 2016, 2:28:20 PM10/24/16
to TiddlyWiki
I have a dropdown...

<$select field='dassection'>
   <$list filter='[tag[section]]'>
     
<option><$view field='title' /></option>
   </$list>
</$select>

It currently populates the option labels, but not the values...

I'd like the values to be populated with the title field, I thought {{!!title}} would work but it didn't.

I'd also like the <$select> to trigger a macro that will set a field with the value of the selected option when it is selected in the <$select>...

So far I have this:

\define updateSERPField()
 
<$action-setfield $tiddler="SERP - Database Analyst - Net Tech - MIS - Help Desk" $field="dassectionfilter" $value="">
\end

and I imagine that if I fill in the actions attribute of my <$select> with <<updateSERPField>> it will make the call, but I don't really know how to connect the two...

Thank you!



Mark S.

unread,
Oct 24, 2016, 2:54:56 PM10/24/16
to TiddlyWiki
Try something like:

\define myfilt() <option value="""[field[$(currentTiddler)$]]"""><$view field='title' /></option>
<$select tiddler="SERP - Database Analyst - Net Tech - MIS - Help Desk" " field='dassection' default="-">
<option>-</option>
   <$list filter='[tag[section]]'>
      <<myfilt>>
   </$list>
</$select>

Note the "-" hyphen used as the default. This forces the user to make a selection. If the user doesn't change the settings of the drop-down, nothing happens. Obviously, you would want to change the filter that I made up.

Good luck,
Mark

leeand00

unread,
Oct 24, 2016, 7:25:33 PM10/24/16
to TiddlyWiki
Okay I gave it a shot, and I've got a dropdown, and the values that appear look right, but when I select and item it doesn't update the field in said tiddler.

leeand00

unread,
Oct 24, 2016, 7:27:20 PM10/24/16
to TiddlyWiki
Nevermind; it works; thank you!
Reply all
Reply to author
Forward
0 new messages