Hmm. Yes it is a bit tricky since toggle[] is a list ops operator. So you 
need to handle the situation where this is an existing value that is not a 
part of the value pair to toggle. I'm short on time at the moment so there 
might be a better solution, but something like this untested solution 
should work:

<$action-listops $tiddler="$:/palette" $field="text" 
$filter="""[enlist{$:/palette}] -$:/palettes/Vanilla 
-$:/palettes/SolarFlare :and[then[$:/palettes/Vanilla]] 
:else[enlist{$:/palette}toggle[$:/palettes/Vanilla],[$:/palettes/SolarFlare]]"""
 
/>

On Monday, December 14, 2020 at 1:44:42 PM UTC+1 Mohammad wrote:

> I use the below button to toggle between day/night palette 
>
> <$button>Day/Night
> <$action-listops $tiddler="$:/palette" $field="text" 
> $subfilter="+[toggle[$:/palettes/Vanilla],[$:/palettes/SolarFlare]]" />
> </$button>  
>
> The problem here is if $:/palette is not empty and has not one of the two 
> values above, then I get the wrong values in the text field (actually the 
> value is appended). How can I replace the field value using toggle operator.
>
>
>
> Best wishes
> Mohammad
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ca127640-26b5-4655-b5dd-22a7c6c61f20n%40googlegroups.com.

Reply via email to