Moving values from one field to another

Upon clicking a button, I want to be able to move the value of ‘fielda’ to ‘fieldb’ of ‘Test’ tiddler.

So, I wrote the following:

<$button>
  <$action-setfield $tiddler="Test" fieldb={{!!fielda}} />
  A to B
</$button>

But that does not work.

What is going wrong? How do I correct it?

{{!!fielda}} references a field in the current tiddler, which is very likely NOT “Test”

One way to fix this is to wrap the <$action-setfield> widget within a <$tiddler> widget, like this:

<$button> A to B
<$tiddler tiddler="Test"><$action-setfield fieldb={{!!fielda}}/></$tiddler>
</$button>

Note that this also allows you to omit the $tiddler="Test" param from the <$action-setfield>, allowing it to default to the currentTiddler as set by the enclosing <$tiddler> widget.

enjoy,
-e

1 Like