I have no clue how to target the field of another tiddler in $reveal widget

Hi folks,

I am creating a system to manage a list of events (header, date, text) associated to a tiddler (his history).
Now I want to edit an event without opening the event tiddler, but directly in the history display.
For that, I need to display a ‘switch’ button per event that switch between ‘view’ and ‘edit’ display modes.

In my event template, I want to use the $reveal widget but I can’t figure out how to target the correct tiddler (stored in the variable “item” instead of “currentTiddler”, from the history loop).

I have tried this:
<$reveal type="match" state="<<item>>!!mode" text="edit">
and this :
<$reveal type="match" stateTitle=<<item>> stateField="!!mode" text="edit">

What am I doing wrong? (v 5.2.1)

Welcome to the forum, TartakOO!

If I understand what you’re doing, then this version should work:

<$reveal type="match" stateTitle=<<item>> stateField="mode" text="edit">

It’s good, if possible, when asking for help to have a demo set-up (TiddlyHost is popular) so it’s easier to understand what’s happening.

This may be a personal choice, but I usually use the list widget for this kind of decision switch. It’s just easier to become proficient in one tool than to try to remember all the various attributes for two.

3 Likes

Thanks a lot, Mark!

This was the missing piece.
I love TW but the syntax drives me crazy sometimes…

And you are right, I am already using the list widget to make if then else constructions elsewhere, I have no need for the reveal construction. By the way, I think an explicit if widget should be added, this would make the code easier to understand and the choice of widget obvious.