How to use select widget without link filed?

Hi,

the simple procedure will show the double number which the selected on $list

\procedure easyDouble()
<$select field="myNumber">
  <$list filter="[range[1],[100]]" variable="current">
    <option value=<<current>>><<current>></option>
  </$list>
</$select>

<$set name="dataNumber"  filter="[{!!myNumber}multiply[2]]">
Double Number is: <<dataNumber>>
</$set>
\end

I add a tag “$:/tags/globe” to the Tiddler

then create 3 Tiddlers, all Tiddlers called procedure

<<easyDouble>>

It works, but all Tiddlers added “myNumber” field, very ugly

so I think use a variable to replace select widget filed

\procedure easyDouble()
<$set name="myNumber"  value="1">

<$select field=<<myNumber>>>
  <$list filter="[range[1],[100]]" variable="current">
    <option value=<<current>>><<current>></option>
  </$list>
</$select>

<$set name="dataNumber"  filter="[<myNumber>multiply[2]]">
Double Number is: <<dataNumber>>
</$set>

</$set>
\end

then it not working again.

I want to know how to use select widget without link filed?

1 Like

The select widget needs to use a field in a tiddler so that it can persist between renderings (which occurs whenever you edit a tiddler, for instance). It can’t save it to a variable, which only exists in a lexical context.

But it doesn’t have to use the current tiddler. It can use some other tiddler. And the tiddler can be a temp or state tiddler, so it doesn’t clutter up search results.

A frequent technique is to use the <<qualify>> macro to create the name of a tiddler to save the state/status of a result.

\procedure easyDouble()
<$vars mytid=<<qualify "$:/temp/easydouble">>>
<$select tiddler=<<mytid>> field="text">
  <$list filter="[range[1],[100]]" variable="current">
    <option value=<<current>>><<current>></option>
  </$list>
</$select>

<$set name="dataNumber"  filter="[<mytid>get[text]multiply[2]]">
Double Number is: <<dataNumber>>
</$set>
</$vars>
\end
1 Like