Thank you very much! Works like a charm now! Much much much appreciated!

On Monday, June 21, 2021 at 9:00:23 PM UTC-4 Eric Shulman wrote:

> On Monday, June 21, 2021 at 5:20:24 PM UTC-7 iamdar...@gmail.com wrote:
>
>> ... by deleting the temp tiddler the form would be cleared... However, 
>> that functionality isn't occurring
>>
>
>> \define temp() $:/temp/input/$(currentTiddler)$
>>
>> |      Label:|<$edit-text tiddler=<<temp>> field="label"/>    |
>> |   From Tag:|<$edit-text tiddler=<<temp>> field="fromtag"/>  |
>> |     Target:|<$edit-text tiddler=<<temp>> field="target"/>   |
>> | Target Tag:|<$edit-text tiddler=<<temp>> field="targettag"/>|
>>
>> <$tiddler tiddler=<<temp>>>
>> <$button> <$view field="label">join tiddlers</$view> 
>>    <$action-setfield $tiddler={{!!target}} text={{{ 
>> [tag{!!fromtag}get[text]join[]] }}} tags={{!!targettag}} />
>>    <$action-deletetiddler tiddler=<<temp>> />
>> </$button>
>> </$tiddler>
>>
>
> Let's suppose the containing tiddler is named "MyForm".  Then the value of 
> <<temp>>, as defined in the macro, will be *$:/temp/input/MyForm*.  
> However, once you use <$tiddler tiddler=<<temp>>> to surround the $button 
> code, the value of <<temp>> *within* the $button code will be 
> *$:/temp/input/$:temp/input/MyForm*, so the $action-deletetiddler refers 
> to the wrong tiddler title and does nothing.
>
> The solution is to move the <$tiddler tiddler=<<temp>>> so it only 
> affects the $action-setfield.  Here's a button definition that will work as 
> you intend:
>
> <$button> <$view tiddler=<<temp>> field="label">join tiddlers</$view> 
>    <$tiddler tiddler=<<temp>>>
>    <$action-setfield $tiddler={{!!target}} text={{{ 
> [tag{!!fromtag}get[text]join[]] }}} tags={{!!targettag}} />
>    </$tiddler>
>    <$action-deletetiddler $tiddler=<<temp>> />
> </$button>
>
> Notes:
> * The $view widget uses both tiddler=... and field=... to show the 
> correct label text without being inside the <$tiddler tiddler=<<temp>>>
> * The $action-setfield is still surrounded by the $tiddler widget, so that 
> the field references, {{!!target}}, {!!fromtag} and {{!!targettag}} still 
> get their values from the temp tiddler
> * However, the $action-deletetiddler is no longer within the $tiddler 
> widget, so the <<temp>> value referenced there uses the original 
> $(currentTiddler)$ value (i.e., "MyForm") to construct the correct temp 
> tiddler name
> * Also note that the parameter for $action-deletetiddler is $tiddler=... 
> not tiddler=...
>
> enjoy,
> -e
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a2fdcee1-374b-4b80-b935-926b2b55fa5cn%40googlegroups.com.

Reply via email to