Field value with spaces stored as a tiddler title with brackets from select widget without multiple

Although in multiple select the options that have spaces are stored as [[option with spaces]] (which is interpreted as a tiddler title), the option is stored as a list of words in single select.

Can you suggest any ways to store an [[option with spaces]] in a single select widget?

You can use the actions="..." parameter to modify the stored value after it is selected by using format:titlelist[] to add brackets when the value contains spaces. For example:

<$select tiddler='SomeTiddler' field='somefield'
   actions="<$action-setfield $tiddler='SomeTiddler' $field='somefield'
      $value={{{ [[SomeTiddler]get[somefield]format:titlelist[]] }}}/>">
<option>This is an option containing spaces</option>
<option>This is another option with spaces</option>
<option>This-is-an-option-without-spaces</option>
</$select>

enjoy,
-e

3 Likes

Cool, thanks for this!

And i just figured out that the somefield's value with spaces, even stored without double brackets, is directly taken as a tiddler title in a transclusion such as {{{ [{!!somefield}] }}}, without setting the field value to double brackets with the action widget you proposed. How did i miss that? Lots to learn!

1 Like