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.
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: emptyWhich 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.
<$button>
<$action-sendmessage $message="tm-new-tiddler"
title=<<now "DEL-$(journalTitleTemplate)$">>
tags="$(journalTags)$"
text=""
journal-type="fitness"
journal-part="segment"
year: <<now "YYYY">>
month: <<now "0MM">>
day: <<now "0DD">>
/>
New Tiddler
</$button><$button>
<$action-sendmessage $message="tm-new-tiddler"
title=<<now "DEL-YYY0MM0DD">>
tags="journal"
text=""
journal-type="fitness"
journal-part="segment"
year=<<now "YYYY">>
month=<<now "0MM">>
day=<<now "0DD">>
/>
New Tiddler
</$button>
\define journalButton()
<$button aria-label={{$:/me/language/Buttons/NewFitness/Caption}} class=<<tv-config-toolbar-class>>>
<$action-sendmessage
$message="tm-new-tiddler" title=<<now "Fitness-$(journalTitleTemplate)$">> tags="Journal" journal-type="Fitness" journal-part="segment" year=<<now "0YYYY">> month=<<now "0MM">> day=<<now "0DD">>/>
<$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/NewFitness/Caption}}/></span>
</$list>
</$button>
\end
<$set name="journalTitleTemplate" value={{$:/config/NewJournal/Title}}>
<<journalButton>>
</$set>
...and it works perfectly! Thank you very much Jeremy and great job with TW5!