New tiddler button - what's wrong with it?

127 views
Skip to first unread message

Jon

unread,
Aug 1, 2021, 11:02:42 AM8/1/21
to TiddlyWiki
Hi,

I have this to create a new tiddler from a button with the current date as the title:

\define newtags() [[log]]
<$wikify name="Title" text="""<<now "0DD/0MM/YY">>""">

<$button class="tc-btn-invisible">{{$:/core/ui/Buttons/new-tiddler}} 

<$action-sendmessage $message="tm-new-tiddler" title=<<Title>> tags=<<newtags>> text=<<newtext>> />
   </$button>

It works fine but it also creates an unwanted draft tiddler as well.

Any ideas what's wrong with it?

Regards
Jon

clutterstack

unread,
Aug 1, 2021, 11:57:16 AM8/1/21
to TiddlyWiki

Hi Jon, if you don't want the draft, perhaps the action-createtiddler widget is what you're looking for, rather than the tm-new-tiddler message?

Best,
Chris

Jon

unread,
Aug 1, 2021, 3:19:25 PM8/1/21
to TiddlyWiki
Hi Chris, 

Thanks for that but I'm not sure how to incorporate it into the original - I've played around with it but can't get it to work. Could you spell it out for me?

Thanks
Jon

TW Tones

unread,
Aug 1, 2021, 8:59:55 PM8/1/21
to TiddlyWiki
Jon

When you transclude  {{$:/core/ui/Buttons/new-tiddler}} you are acutely Transcluding the whole button, change this to {{$:/core/images/new-button}}
  • Basically clicking on the button triggers both  $:/core/ui/Buttons/new-tiddler and  $message="tm-new-tiddler"
  • This highlights how a button widget acts somewhat like "on click"
  • ActionCreateTiddlerWidget can create tiddlers without navigating to them (in fact you need to navigate to them) and has more control than   $message="tm-new-tiddler"
However why not use the new Journal here button? 
{{||$:/core/ui/Buttons/new-journal-here}} 
You can change the title format, default content and tags in Control Panel > info > Basics
  • Title of new journal tiddlers
  • Text for new journal tiddlers
  • Tags for new journal tiddlers
Regards
Tones

Jon

unread,
Aug 2, 2021, 1:49:29 AM8/2/21
to TiddlyWiki
Hi Tones,

I just changed  {{$:/core/ui/Buttons/new-tiddler}}  to {{$:/core/images/new-button}} in my original as you suggested and it worked - thanks!

I think I didn't use the new Journal here button because I was thinking I already have that for the journal and I wanted to be able to created new tiddlers with different tags and text

Thanks again
Jon

Jon

unread,
Aug 2, 2021, 1:58:17 AM8/2/21
to TiddlyWiki
p.s. thanks for the explanation as well

Jon

unread,
Aug 2, 2021, 2:07:30 AM8/2/21
to TiddlyWiki
Actually, not having to navigate to the tiddler would be useful. How do I incorporate  the  ActionCreateTiddlerWidget so as to produce the tiddler title as today's date and a tag?
I've looked at the docs but can't quite see how to do it.

Regards
Jon

Brian Radspinner

unread,
Aug 2, 2021, 4:24:56 PM8/2/21
to TiddlyWiki
Jon, give this a try...

\define newTidAction()
<$action-createtiddler
   $basetitle=<<now "0DD/0MM/YY">>
   tags="log"
   text=<<newtext>>
/>
\end
<$button actions=<<newTidAction>> class="tc-btn-invisible">{{$:/core/images/new-button}}</$button>


If you don't have a variable for the text field, you can leave it blank
   text=""

or leave the line out all together

Jon

unread,
Aug 2, 2021, 5:09:25 PM8/2/21
to TiddlyWiki
Many thanks Brian!

Regards
Jon

Reply all
Reply to author
Forward
0 new messages