By using the actions attribute, you can add the things that have to happen
AFTER the creation -- otherwise the button widget doesn't see the new
tiddler.
\define myactions()
<$fieldmangler tiddler={{x:/temp/create}} >
<$action-sendmessage
$message="tm-remove-tag"
$param="Templates"/>
</$fieldmangler>
<$action-deletetiddler $tiddler="x:/temp/create"/>
\end
<$button actions=<<myactions>> >
<$action-createtiddler
$basetitle="Created Tiddler"
$savetitle = "x:/temp/create"
$template="Source Tiddler"/>
Create New Tiddler
</$button>
I changed your savetitle tiddler name while testing. Also, I kept things
simple by not using a field since you were going to delete the tiddler
anyway.
On Monday, April 26, 2021 at 1:28:56 PM UTC-7 Ken wrote:
> I am having a problem getting a fairly simple process working in
> TiddlyWiki.
>
> I want to create a new tiddler based on a template. The template includes
> a Templates tag so I can see all my templates in my TOC. When I create a
> new tiddler using the template, I want to remove the Templates tag.
>
> The name of the template tiddler is "Source Tiddler". In a button, I use
> $action-createtiddler. Because the title of the created tiddler may be
> different from what's specified in the $basetitle attribute, I supply the
> $savetitle attribute with a place to store the actual title. In the code
> below I used a field in a temporary tiddler ($:/temp/create!!actual-title).
> I then try to remove the Templates tag from the newly created tiddler, as
> show in the $fieldmangler widget in the code.
>
> <$button>
> <$action-createtiddler
> $basetitle="Created Tiddler"
> $savetitle = "$:/temp/create!!actual-title"
> $template="Source Tiddler"/>
>
> <$fieldmangler tiddler={{$:/temp/create!!actual-title}}>
> <$action-sendmessage
> $message="tm-remove-tag"
> $param="Templates"/>
> </$fieldmangler>
>
> <$action-deletetiddler $tiddler="$:/temp/create"/>
> Create New Tiddler
> </$Button>
>
> This creates the new tiddler, and stores the correct value in the field
> (which I verified by commenting out the action-deletetiddler code).
> However, the tag does not get removed. I have tried storing the actual
> title in a field in the tiddler containing the button and in the text of a
> new tiddler, but cannot seem to figure out the correct syntax to use so the
> $fieldmangler widget correctly sets the currentTiddler.
>
> Note that if I hard code the $fieldmangler widget as follows, the tag is
> correctly removed!
>
> <$fieldmangler tiddler="Created Tiddler">
>
> So I would like advice on 1) Where should I store the savetitle and 2)
> what is the appropriate syntax to use for the tiddler attribute in the
> $fieldmangler widget?
>
> Thank you.
>
> Ken
>
--
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/3ebe7f90-c5c6-4e9c-9b82-c623ef31be62n%40googlegroups.com.