Setting custom fields to blank link tiddlers?

I’m trying to add the custom fields “caption” “icon” and “color” to tiddlers I open by clicking a link to a tiddler that doesn’t yet exist, but I’m not entirely sure where to go in TW to add those fields.

I already edited $:/core/ui/Actions/new-tiddler to have those fields, as well as $:/core/ui/Buttons/new-here, but could someone point me towards the right tiddler to add these fields to any non-existent tiddler?

I do not recommend to modify the core tiddlers.

This is an example using $button and $action-createtiddler

<$button>
<$action-createtiddler $basetitle="My New Tiddler" tags="myTag" text="MyText" caption="" icon="" color="">
<$action-navigate $to=<<createTiddler-title>>/>
</$action-createtiddler>
My New Tiddler
</$button>

For more info: ActionCreateTiddlerWidget in tiddlywiki.com

Note: If you like new tiddler in edit mode look at WidgetMessage: tm-new-tiddler

<$button>
<$action-sendmessage 
  $message="tm-new-tiddler" 
	title=<<unusedtitle>> 
	tags="OneTag [[Another Tag]]"
	text=<<now "Today is DDth, MMM YYYY">>
	icon=""
	caption=""
	color=""
	/>
New Tiddler
</$button>

p.s: change the default title, text, … as you like

Is there a method of doing the first without it being a button? for instance, setting a template for all new tiddlers created by clicking on missing links to use? Sorry if that’s a bit of a noobish question haha

The reason I ask is, I use a specific color and icon for each type of tiddler in my method of organizing, and creating a tiddler from a [[Tiddler|Non-Existing Tiddler]] results in me having to copy the icon and color code from another tiddler and put them into this one, when I’m ready to populate it with text.

Edit: made a quick adjustment to my wording, by clicking the missing link for the action, my bad!

Create a tiddler needs action! So clicking can be used to create the tiddler. But clicking missing links and creating a tiddler from a template means you need to deal with core tiddlers!

So, lets see what other people propose.

there is a thread in the google group that might help?

https://groups.google.com/g/tiddlywiki/c/0MqLimtsmxU/m/Aqn0TP31AgAJ

While I might be missing what you’re recommending, it was worth reading about adding a custom made field, but it didn’t have the answers I was looking for, sadly. I still appreciate it though, i found some interesting info about the $/tags/EditTemplate tag!

My goal is to change the behavior of clicking on a .tc-tiddlylink-missing tiddler link and it creating a new tiddler with the fields I listed above, rather than it making a new empty tiddler without those field, and instead of having to make a button for it.
Sadly it seems to be a bit above my level of know-how with tiddlywiki.

EDIT: Correction! This actually is what I am looking for! I missed the [[url]] part

However, even when clicking the trashbin to remove it, I’m not able to, and this only creates a blank field, without the ability to add text to the field., and I can only add one field.
Would there be a way to fix these things?
I kind of wish there was a $:/config/NewTiddler/Fields tiddler, where you could put something like color="#6699FF" caption="Title!" icon="etc." or something along those lines. Food for thought!

eric’s modification is to remove the “duplicate” at the bottom of the fields list (i think it’s more of an input, which is why it doesn’t have a trashbin, and why we’re altering the edittemplate?)

if you use brian’s original code you’ll get the prompt for input, and once you enter a value it will produce a line for the field as well (so “duplicate” lines)

since it’s an input i think you don’t get a real field stored until you complete the input, which is something you might want to consider in your workflow – and as you’ve noticed, having a default value doesn’t seem to work (it seems like you actually need to alter the field value before it recognises it as something it can save)

i would personally use mohammad’s recommendation (i use something similar for several fields and have the button visible at all times – some people add it to the sidebar) as you are guaranteed the fields will populate just from creating the new tiddler

but it’s swings and roundabouts, with brian and eric’s recommendation you can do it for missing tiddlers (but you need to enter a value and save it) while with mohammad’s recommendation you need to click the button and default can be automated (but it won’t work for missing tiddlers, you’d need to alter your workflow)

yes i agree that would make sense, and have it in the control panel too; maybe it’s not so easily doable in the code :slight_smile:

in a different direction, did you see linonetwo’s thread about templates? What are your favorite tiddler templates?

yep! having it in the control panel was exactly what I was thinking.

I did not, I’m not particularly familiar with templates past making one for adding text when pressing a button.

i’m not sure I understand what a template is, in the context of the post he made

Justin there are a lot of different uses for tge word template in tiddlywiki.

Although a good rule not to overwrite core tiddlers it may still be a valid approach. For example modifying the missing tiddler message so that after clicking on a missing tiddler link rather than only the missing tiddler message a button appears to apply your desired settings may work nicely.

This could be extended to include other types later.

I can provide more details if your interested?

great thinking @TW_Tones ! something like changing

$:/language/MissingTiddler/Hint

Missing tiddler "<$text text=<<currentTiddler>>/>" -- click <$button style="width:16%;height:20px;border-color:transparent;font-size:14px"><$action-sendmessage $message="tm-new-tiddler" text="" learn-deck="test01" learn="test02" se-type="" />new</$button> to create

actually should probably leave the original code there as well

Missing tiddler "<$text text=<<currentTiddler>>/>" -- click {{||$:/core/ui/Buttons/edit}} to create

click <$button style="width:16%;height:20px;border-color:transparent;font-size:14px"><$action-sendmessage $message="tm-new-tiddler" text="" learn-deck="test01" learn="test02" se-type="" />new</$button> to create a custom tiddler
1 Like

In fact setting the fields in currentTiddler is all you need to create it.

Could you explain what you mean by that? I see the <<currentTiddler>> in the `$:/language/MissingTiddler/Hint, how would I set fields inside of that?

(Also your previous comment works perfectly!)

When you have a missing tiddler open, it is the current tiddler and your button need only set one or more fields and the tiddler is created. Its somewhat trivial but no need for a tm-new-tiddler or createtiddler.

Would I be able to use that to replace the Edit button at the top right of the tiddler with my own button, just for the missing tiddler?

Edit: probably better to create a new thread for this if I really need it!

This is a solution, but it overwrite a core tiddler!
May be @jeremyruston can give some directions here!

This solution does not need to overwrite anything, in a tiddler tagged $:/tags/ViewTemplate

<$list filter="[all[current]is[missing]]" variable=~>
   <$button>
     <$action-setfield object-type="todo"/>
     Make Todo
   </$button>
</$list>

[[Yiddlr name]]
  • Click on the link to open a “missing tiddler”
  • This button only appears on missing tiddlers
  • This list filter could also be used to conditionally display this button in the view Toolbar
  • You could use list-before or list-after to set the buttons position in the viewTemplate
  • It also demonstrates how setting one field also creates the tiddler and when viewing missing tiddlers the currentTiddler variable is available.
1 Like

This is probably the ideal way to handle this, though I noticed it also adds the button at the bottom of unedited system tiddlers as well, changing it from
<$list filter="[all[current]is[missing]]" variable=~>
to
<$list filter="[all[current]!is[system]is[missing]]" variable=~> is a solution to this?

I found that this works ideally for me at the moment:

tagged: $:/tags/ViewTemplate

<$list filter="[all[current]!is[system]is[missing]]" variable=~>
   <$button message="tm-edit-tiddler">
     <$action-setfield caption="FIX"/>
     <$action-setfield color="#6699FF"/>
     <$action-setfield icon="$:/core/images/bold"/>
     {{$:/core/images/full-screen-button}}
   </$button>
</$list>

The fields and icon are just placeholders to see if I was doing it right :sweat_smile:

2 Likes