Hello all!
I’m trying to use the <$select>
widget in a procedure to do the following:
- build a list of tiddlers that have a certain tag, field, and value in that field, to be rendered as a dropdown menu
- use a state tiddler to hold the relevant selection, that will create or update a field which name comes from the procedure call, and the value comes from what the user selects in the dropdown
- transclude the created/updated field and its value from the state tiddler to whatever tiddler the procedure is called from
I currenlty have the following procedure:
\procedure select-mod(advantage)
<$select tiddler='$:/generated-list-mod-state' field=<<advantage>> actions='<$action-setfield $field=<<advantage>> $value={{{ [{$:/generated-list-mod-state!!<advantage>}] }}}/>'><option disabled>Select modifier</option>
<optgroup label='Special'>
<$list filter='[tag[GURPS Modifier]search:to-advantages:<advantage>]'>
<option><$view field='title'/> (<$view field='modifier-value'/>%)</option></$list></optgroup>
<optgroup label='Global modifiers'>
<$list filter='[tag[GURPS Modifier]!has[to-advantages]] -[title[Modifier template]]'>
<option><$view field='title'/> (<$view field='modifier-value'/>%)</option></$list></optgroup></$select>
<$tiddler tiddler={{$:/generated-list-mod-state}}><$transclude mode='block'/></$tiddler>
\end
Testing the procedure, the menu builds fine, choosing an option of the menu does populate the state tiddler correctly with a field named from the variable <advantage>
, with the correct value selected, but the final transclusion only transcludes the correct field name, without its value (i.e. it remains empty). This looks like a bracket/syntax issue of some sort, but despite looking again the select widget documentation and Those Pesky Brackets, I can’t seem to figure it out?