Weird $action-setfield issue - field getting set to previous value

43 views
Skip to first unread message

MagoArcade

unread,
Jul 30, 2019, 2:50:57 PM7/30/19
to TiddlyWiki
OK. Tough to explain this one. I have a tiddler, $:/_opNodeDetsEdit:

<$tiddler tiddler="$:/_opNodeDetsEditText">
    <$transclude tiddler="$:/core/ui/EditTemplate/body/editor"/>
</$tiddler>

Which produces this:

opNodesDetsEdit.png


$:/_opNodeDetsEditText is just a blank 'holder' tiddler. 

I transclude this into a tiddler called $:/_opAddNode so users can edit without having to edit the tiddler itself. Transclude via:


Description: {{$:/_opNodeDetsEdit}}

Which produces:

opNodesDetsEdit2.png

Now, when I click "Create New" this produces a new tiddler based on a template. The problem is - all the fields are populated properly apart from that derived form the Description box. What gets put there is the value before the current one (say in this example "goodbye cruel moon" was there before "Hello World" "goodbye cruel moon" would get populated. Consider the code that creates the new tiddler:

<!-- ADD NEW TIDDLER -->


<$wikify name="myfinal" text=<
<final>> >


<$button popup="bob" >Create Item


<$action-setfield $tiddler="$:/_opTaskStore"
itemTitle=<
<myfinal>>
desctext={{$:/_opNodeDetsEditText!!text}}
/>


<$set name="desctext" value={{$:/_opNodeDetsEditText!!text}}>


Desctext: <
<desctext>>


<$action-setfield $tiddler="$:/_opEditNode"
title=<
<myfinal>>
shorttext={{$:/_opTaskStore!!taskname}}
description=<
<desctext>>
tags={{$:/_opTaskStore!!tags}}
nodetype= {{!!nodetype}}
tmap.id={{{ [[]make[%uuid%]] }}}
createdby={{!!createdby}}
managedby={{!!managedby}}
owner={{!!owner}}
assignedto={{!!assignedto}}
taskstatus={{!!taskstat}}
taskpercentage={{$:/_opTaskStore!!taskpercentage}}
color={{$:/_opTaskStore!!color}}
duedate =  {{$:/_opTaskStore!!duedate}}
stalldate =  {{$:/_opTaskStore!!stalldate}}
completiondate =  {{$:/_opTaskStore!!completiondate}}
/>


<$reveal type='popup' state='bob' position='below'>
<div style='background-color:lightgreen'>
New Item created successfully:
<br>
{{$:/_opTaskStore!!itemTitle}}
<br>
<$link to={{$:/_opTaskStore!!itemTitle}}>Click to View</$link>
</div>
</$reveal>


<$action-setfield $tiddler="$:/_opTaskStore"
taskname=""
tags=""
taskpercentage=0
/>


<$action-setfield $tiddler="$:/_opNodeDetsEditText"
text=""
/>


</$set>


</$button>


</$wikify>


You can see I set a variable:

<$set name="desctext" value={{$:/_opNodeDetsEditText!!text}}>

As a debug I also print this live into the edit tiddler:

Desctext: <<desctext>>

Which renders the correct current version (see the picture above in the button)

However, when I save exactly the same variable, I get the old version!?

Can anyone shed any light on what is progressively becoming one of the highest dark arts of coding (i.e. TiddlyWiki!)

MagoArcade

unread,
Jul 30, 2019, 3:52:39 PM7/30/19
to tiddl...@googlegroups.com
Nevermind. Figured it. It was to do with the action-setfield method  -  I had to set the fields in the state tiddler first and then set again but setting the title field to create the new tiddler. As below:

<$action-setfield $tiddler="$:/_opEditNode"
shorttext={{$:/_opTaskStore!!taskname}}
description=<
<desctext>>

tags={{$:/_opTaskStore!!tags}}
nodetype= {{!!nodetype}}
createdby={{!!createdby}}
managedby={{!!managedby}}
owner={{!!owner}}
assignedto={{!!assignedto}}
taskstatus={{!!taskstat}}
taskpercentage={{$:/_opTaskStore!!taskpercentage}}
color={{$:/_opTaskStore!!color}}
duedate =  {{$:/_opTaskStore!!duedate}}
stalldate =  {{$:/_opTaskStore!!stalldate}}
completiondate =  {{$:/_opTaskStore!!completiondate}}
tmap.edges={{$:/_opTaskStore!!tmapedges}}
/>



<$action-setfield $tiddler="$:/_opEditNode"
title=<
<myfinal>>
tmap.id={{{ [[]make[%uuid%]] }}}
/>


TonyM

unread,
Jul 30, 2019, 5:23:34 PM7/30/19
to TiddlyWiki
Thanks for the update.

Reply all
Reply to author
Forward
0 new messages