How to get two tags from a select option?

Hi everyone!
I’m in the process developing my Wiki, and new targets are coming up.
Right now I have a button that create a new tiddler with two differents tags:

  1. for object’s type
  2. for domain’s type.
    Now, I want to be able, when I selected one of the domain’s type options, instead of creating one tag, it creates two different tags.
    For example, if i select the option ThermalResource, it creates two tags: “Heat” and “Water”.

I’m trying to apply [format:titlelist[]join[ ] within the function f.getTags() only for the text coming from f.tempDomain(), but it’s not working.
Anyone knows how it will be possible to implement that?
I will be very greatfull!
Rosi

\function f.tempTiddler() $:/temp/rosi/new-tiddler-title
\function f.tempObject()  $:/temp/rosi/new-tiddler-object
\function f.tempDomain()  $:/temp/rosi/new-tiddler-domain

\function f.getNewTitle() [<f.tempTiddler>get[text]trim[]]

\function f.getTags() [<f.tempObject>get[text]] [[<f.tempDomain>get[text]+[format:titlelist[]join[ ]]] +[format:titlelist[]join[ ]]

\procedure deleteTempTiddlers()
<$action-deletetiddler $filter="[prefix[$:/temp/rosi/]]" />
\end

\procedure newTiddlerActions()
<% if [<f.getNewTitle>has[text]] %>
  <$action-navigate $to=<<f.getNewTitle>>/>
<%else%>
  <$action-createtiddler
    $basetitle=<<f.getNewTitle>>
    tags=<<f.getTags>>
    text="Este es un tiddler con etiqueta"
  >
    <$action-navigate $to=<<createTiddler-title>>/>
    
  </$action-createtiddler>
  <!-- delete all temporary tiddlers -->
  <<deleteTempTiddlers>>

<%endif%>
\end


<!-- Campo para introducir el título del nuevo tiddler -->
1. Introduce un título: <$edit-text tiddler=<<f.tempTiddler>> field="text" tag="input" class="tc-edit-textinput"/><br>
- sin espacios.<br>
- empezando cada palabra con mayúsculas<br>
Ej. RiskSources <br>


<!-- Dropdown para seleccionar una etiqueta sobre el tipo de OBJETO-->
2. Elige un tipo de OBJETO: 
<$select tiddler=<<f.tempObject>> field="text" default="">
  <option disabled>Selecciona una etiqueta</option>
  <option value="">-none-</option>
  <option value="Costs">Costs</option>
  <option value="Issues">Issues</option>
  <option value="Parameter">Parameter</option>
  <option value="Community">Community</option>
  <option value="ManagingEntity">Managing Entity</option>
</$select>

<!-- Dropdown para seleccionar una etiqueta sobre el tipo de DOMINIO -->
3. Elige un tipo de DOMINIO: 
<!--<$set name="selected" value={{<<f.tempDomain>>!!text}}> -->
<$select tiddler=<<f.tempDomain>> field="text" default="">
  <option disabled>Selecciona una etiqueta</option>
  <option value="">-none-</option>
  <option value="Regulation">Regulation</option>
  <option value="Nature">Envi.& Nature</option>
  <option value="Wellness">Wellness</option>
  <option value="Heat">Heat</option>
  <option value="Water">Water</option>
  <option value="HealthSystem">Health System</option>
  <option value="[[Heat]] [[Water]]">Thermal Resource (Heat + Water)</option>
  <option value="[[Heat]] [[Water]] [[HealthSystem]]">Thermal Therapy</option>
  <option value="[[Heat]] [[Water]] [[Wellness]]">Non-Therapy Use</option>
</$select>

<!-- Botón para crear el tiddler con ese nombre -->
4. Presiona el botón 
<$button actions=<<newTiddlerActions>> >
  Crear nuevo tiddler
</$button>   ```

Try this:

\function f.getTags() [<f.tempObject>get[text]] [<f.tempDomain>get[text]enlist-input[]] +[format:titlelist[]join[ ]]

Notes:

  • Use enlist-input[] to split the text field value from f.tempDomain into separate list items.
  • None of your individual tag values contain embedded spaces, so you don’t need to use the format:titlelist[] operator (but it doesn’t hurt anything to have it there).
  • In your $select list, you don’t need to use square brackets unless a particular tag value contains spaces. Thus, you can write:
  <option value="Heat Water">Thermal Resource (Heat + Water)</option>
  <option value="Heat Water HealthSystem">Thermal Therapy</option>
  <option value="Heat Water Wellness">Non-Therapy Use</option>

enjoy,
-e

1 Like

Thanks so much @EricShulman!
It works perfectly!!
May I ask you one thing, do you know if there exits a document or webpage with a complete list of this kind of actions? (enlist-input[], format: titlelist[]join[] or $action-navigate, $action-creatiddler).
Rosi

For a complete (or nearly complete) list of filter operators, see: Filter Operators
Similarly, for a list of $action- widgets, see ActionWidgets

Note that, both of these lists do not include additional filter operators and $action- widgets that may be defined by plugins from the “Official TiddlyWiki Plugin Library” (see $:/ControlPanel > Plugins > “Get More Plugins”) or 3rd-party (community published) plugins.

For example, see $:/plugins/tiddlywiki/geospatial/docs for many additional operators and widgets defined by the Geospatial Plugin.

enjoy,
-e

1 Like

Uaaooo!! Thanks a lot for the links.
And i didn’t know about this Geospatial Plugin, very interesting for me.
Thanks a lot @EricShulman
Rosi