I'm a long time user of classic TiddlyWiki, but am new to TW5. I'm trying to
create buttons for different journal types, e.g., personal, fitness, food.
I've used the existing documentation I could find on tiddlywiki.com and this
forum to successfully create the button that creates the new journal tiddler
with the title I want, which is a journal type specific prefix to the current
date and time, and tags. The generated tiddlers are automatically opened for
editing.
I'm having a bit of difficulty adding custom fields to the button generated new
tiddlers. What i'm wanting is for the custom fields to appear, along with
their pre-assigned values, in the newly generated tiddlers that are open for
editing. I don't want to have to add the custom fields and values manually
after creation or saving. In other words, to create an entry in the journal I
only want to have to hit the New Journal button (for the desired journal type),
type the text of the entry and hit save without having to do anything else.
For instance:
Title: Fitness-YYYYMMDDHHMMSS
Tags: Journal, Additional Tags...
Text: empty
Which is working at this point. But I also want custom user fields:
journal-type: (E.G., personal, fitness,
journal-part: (E.G., segment, entry)
year: 2017
month: 03
day: 14
Which I can't figure out how to do.
I've tried using the $fieldmangler and action-setfield within the button code,
to no effect. It doesn't add any fields the the newly created and opened for
editing tiddler.
I've spent hours on this forum searching for an answer, as well as a lot of
additional hours on Google searching, but to no avail. Any help or directions
to help would be greatly appreciated.
Ultimately, my goal is to use the custom fields to automatically add the
entries of the journals into the TOC, which I'm doing now with tags, with a
hierarchy of journal type, year, month and day, in order to alleviate the
amount of bloat to my tags. However, for right now, I'll just be happy to get
the code for the new journal buttons working correctly.
Below is the current code for the button: The title of this tiddler is
$:/me/Buttons/NewFitness and it is tagged $:/tags/PageControls
\define journalButton()
<$fieldmangler>
<$button tooltip={{$:/me/language/Buttons/NewFitness/Caption}}
aria-label={{$:/me/language/Buttons/NewFitness/Caption}}
class=<<tv-config-toolbar-class>>>
<$action-setfield journal-type="fitness" journal-part="segment"/>
<$action-sendmessage $message="tm-new-tiddler" title=<<now
"DEL-$(journalTitleTemplate)$">> tags="$(journalTags)$"/>
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/new-journal-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text
text={{$:/me/language/Buttons/Fitness/Caption}}/></span>
</$list>
</$button>
</$fieldmangler>
\end
<$set name="journalTitleTemplate" value={{$:/config/NewJournal/Title}}>
<$set name="journalTags" value="Journal">
<<journalButton>>
</$set></$set>
The only part of this that doesn't work is adding the custom fields to a newly
created tiddler. Thank you in advance for your help.
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/26b0ab5d-ab90-4e99-ba2c-3bc3d52be008%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.