I use the new CheckboxWidget with the listField mode and I need to replace the old RevealWidget.
I don’t know how to do this because the RevealWidget has not an option to look in the list fields for an entry.
How can I do this?
I use the new CheckboxWidget with the listField mode and I need to replace the old RevealWidget.
I don’t know how to do this because the RevealWidget has not an option to look in the list fields for an entry.
How can I do this?
I often use the list widget to use a filter to determine if I am to display anything. In fact I rarely use the reveal widget. Just have a filter resolve to one value or empty. and sat the variable name eg variable=nul
to keep the currentTiddler valid.
The state
attributue of the reveal-widget can be a text-reference which can be written like this: tiddlerName!!field-name
If you only use the !!field-name
shortcut, the currentTiddler
is used.
So how does your current “reveal” code look like?
The field to which @Leon_Gonzalez is mentioning is a list field containing one or more titles. He wished to test if that field contains a titles then reveal.
If we use a list field (created using the checkbox listField) we can use a filter in a $list widget, to test if that field contains a particular title;
eg
<$list filter="[all[current]contains:list-field<testvalue>]" variable=nul>
what we want to reveal when the current tiddlers list-field contains the value in the variable `<<testvalue>>/title`
</$list>
This replaces the reveal but you can’t use its animation etc…
Thats wonderfull!!!
I use the code:
<$checkbox listField="fases" checked="fase_1"> Fase 1 </$checkbox><br/>
<$checkbox listField="fases" checked="fase_2"> Fase 2 </$checkbox><br/>
<$checkbox listField="fases" checked="fase_3"> Fase 3 </$checkbox><br/>
<$checkbox listField="fases" checked="fase_4"> Fase 4 </$checkbox><br/>
<$checkbox listField="fases" checked="fase_5"> Fase 5 </$checkbox><br/>
<$list filter="[contains:fases[fase_1]]">
what we want to reveal when the current tiddlers list-field contains the value in the variable
</$list>
Now I have a problem: I need to show a paragraph if “fase_1” IS NOT in “fases”, but the code:
<$list filter="![contains:fases[fase_1]]">
what we want to reveal when the current tiddlers list-field not contains the value in the variable
</$list>
Is not working. Is this posible?
Try this instead, [!contains:fases[fase_1]]
, the above has a syntax error, put the ! goes next to the [contains](file:///I:/TW5%20Intranet/MyBundles/Working/5.3.0%20Play.html#contains%20Operator).
that’s worst!! it does not work.
Your filter needs to restrict it’s logic to the current tiddler…
Thus:
<$list filter="[<currentTiddler>contains:fases[fase_1]]">
the current tiddler's `fases` field contains the value `fase_1`
</$list>
and
<$list filter="[<currentTiddler>!contains:fases[fase_1]]">
the current tiddler's `fases` field does NOT contain the value `fase_1`
</$list>
Alternatively, for short bits of text, you can use the emptyMessage="..."
syntax, like this:
<$list filter="[<currentTiddler>contains:fases[fase_1]]"
emptyMessage="the current tiddler's `fases` field contains the value `fase_1`">
the current tiddler's `fases` field contains the value `fase_1`
</$list>
enjoy,
-e