Create new tiddler from template fill title an jump to text field

1,258 views
Skip to first unread message

Robin

unread,
Apr 11, 2018, 6:00:22 PM4/11/18
to TiddlyWiki

I`found tiddly wiki a few weeks ago and trying it out since.

Now I'm stuck

This probably so basic that no one mentioned it and my searching failed.



I want to create a tiddler from a template tiddler

I made a macro for the button (deleted the clutter for this example set fields/tags)

Used the macro because it works for some reason (don't know why) better with multiple buttons in a table.



And here I'm stuck:

I want to create a text box to input the title for my new tiddler

Giving my new tiddler that title

and jump to the text section when the new draft with my title is created.

As I understand (please correct me if wrong)

A tiddler title is also a field, so what do I use:

FieldManglerWidget or the ActionSetFieldWidget or the ActionCreateTiddlerWidget


\define CreateMyTiddler()

<$button message="tm-new-tiddler" param="$:/NewTiddler" >

Create Tiddler</$button>

\end

|<< CreateMyTiddler1 >>|<< CreateMyTiddler2 >>|<< CreateMyTiddler3 >>|

Q1:How do I give the title value to my macro or is there an easyer solution
Q2:How do I jump directly to the body of the tiddler

I know I have to check the title vs existing tiddlers I think that part works fine.
 

Stephan Hradek

unread,
Apr 14, 2018, 6:49:25 PM4/14/18
to TiddlyWiki
I do not fully understand your exampl.

Can you give full tiddlers so that we can recreate and test it on tiddlywiki.com?

Mat

unread,
Apr 15, 2018, 5:28:34 AM4/15/18
to TiddlyWiki
My interpretation is this:

You want, somewhere in TiddlyWiki, a field where you fill in the title. Next to it is a button that, when clicked, creates the tiddler from some template and shows it in edit mode with the title filled in and with focus on the text area.

Correct?

<:-)

Robin

unread,
Apr 15, 2018, 6:31:04 AM4/15/18
to TiddlyWiki


Op zondag 15 april 2018 11:28:34 UTC+2 schreef Mat:

Yes that is exactly what I wanted to do, with 1 more, I wanted to create that tiddler from a template.

The only way I found so far was to create a new tiddler from the template, clone that one and rename that tiddler and delete the first tiddler.
As described here:


The simplest way appears to be:

-- enter the 'newtitle' to a temp tiddler or field, via an edit-text widget (starting out with the current title)
-- create a "Rename Tiddler" button:
      -- creates a clone (using 'currentTiddler' as the template) with the title set to value of 'newtitle' ('tm-new-tiddler')
      -- deletes the original tiddler ($action-deletetiddler widget)

To create the clone, you may find the $x-maketid widget from here more convenient to use than an $action-sendmessage widget.


That looked to me like overdoing it.This can't be that crazy.

The only other possible sollution was with the tm-new-tiddler widget but I cant figure out how to use the paramObject (not much info found).

A point in the right direction would be much appriciated.



TonyM

unread,
Apr 15, 2018, 9:18:26 AM4/15/18
to TiddlyWiki
I may be able to give you more tomorrow but the solutions I have seen that do what you want save the new tiddler name in a state tiddler, then you click on a button which uses multiple actions widgets to make a new tiddler with transcluding the state tiddler as the title, then open it for edit. I presume by template you mean with a default text content? If it is not to much the new tiddler action can specify text="text" and perhaps text={{textsourcetiddler}}.

On a side note I would like a clone here button in addition to new here which lets you edit the title and nominate the tiddler to clone.

To be honest I create most of my tiddlers with new, new here and clone except for custom tiddlers. I am keen to develop ways to copy tags and fields and or there values from one tiddler to the next.

Regards
Tony

Thomas Elmiger

unread,
Apr 15, 2018, 11:39:47 AM4/15/18
to TiddlyWiki

Robin

unread,
Apr 15, 2018, 2:07:31 PM4/15/18
to TiddlyWiki
@Thomas,

I did found that page.

But it creates a new tiddler where the title comse from the body of an other tiddler that u manipulate with the input field.

What I couldn't do with it was create that tiddler based on a template

I tried this (it doesnt work but maybe it explains it beter).

First I have a template tiddler $:/MyNewTiddler with a few custom fields

Then a input field

Project Step: <$edit-text tiddler="$:/MyNewTiddler" tag="input" default="" class='tc-edit-texteditor' placeholder=Project step' name'/>


That puts the custom text in the body of that tiddler
Then a button

<$button>
<$action-createtiddler param="$:/MyNewTiddler" $basetitle={{$:/MyNewTiddler} tags="projectA" text="Description of materials"/>
Add
</$button>

I know this part is wrong param="$:/MyNewTiddler but I don't know why.

@Tony

I'm sorry but for me there is still confusion between state, shadow and systemtiddlers.
But that is something I need to find out

100% correct with the

On a side note I would like a clone here button in addition to new here which lets you edit the title and nominate the tiddler to clone.

that is the basis of what I am hoping to do.



Op zondag 15 april 2018 17:39:47 UTC+2 schreef Thomas Elmiger:

Thomas Elmiger

unread,
Apr 15, 2018, 3:06:34 PM4/15/18
to TiddlyWiki
What I noticed in your second code example is that your brackets are not symmetrical {{…} should be {{…}}.

The only template based new tiddler button I have created looks like this:

<$button message="tm-new-tiddler" param="TemplateTitleHere" class="classname">{{$:/core/images/new-button}}</$button>

I doubt if a template can be combined with a title entered by the user ... but I might be wrong.

Good luck!
Thomas

Craig Chandler

unread,
Apr 16, 2018, 12:29:03 AM4/16/18
to TiddlyWiki
use $action-sendmessage and tm-new-tiddler. You get access to more parameters.

<$button>
<$action-sendmessage $message="tm-new-tiddler" param="MyTemplate" title="NewTitle" />
Create Tiddler
</$button>

Robin

unread,
Apr 16, 2018, 5:50:36 AM4/16/18
to tiddl...@googlegroups.com
I think I figgured it out

I made a template tiddler MyTemplate

A tiddler to store the title MyTitle



Tiddler Name: <$edit-text tiddler="MyTitle" tag="input" default="" class='tc-edit-texteditor' placeholder='Tiddler Title'/>


<$button>Make Tiddler
<$action-navigate $to={{MyTitle}}/>
<$action-setfield $tiddler='MyTemplate' $field='title' $value={{MyTitle}}/>
<$action-sendmessage $message="tm-edit-tiddler" $param={{MyTitle}}/>
<$action-deletefield $tiddler=MyTitle text/>
</$button>
<br>





Ste Wilson

unread,
Apr 22, 2018, 8:43:38 AM4/22/18
to TiddlyWiki
Sorry to drag this back up but I'm a bear of little brain.

I get that this can make a new tiddler with a title entered into the presented field box...

Can this be extended to ask for some more fields which get filled in in the new tiddler too?

Stephen

TonyM

unread,
Apr 22, 2018, 9:46:25 AM4/22/18
to TiddlyWiki
Ste,

Yes I belive it can be extended and there are other alternatives but also consider creating a tiddler automaticaly open in edit mode, changing the title and adding and editing fields. I often use clone tiddler to this end, and are building and finding tools to help manage fields.

Regards
Tony

Ste Wilson

unread,
Apr 22, 2018, 10:14:15 AM4/22/18
to TiddlyWiki
Yeah. The clone tiddler has been my goto button but this could be.. Shinier :D

Craig Chandler

unread,
Apr 22, 2018, 7:50:51 PM4/22/18
to TiddlyWiki
Add your field in the  action-sendmessage parameters, ie:

<$action-sendmessage $message="tm-new-tiddler" param="MyTemplate" title="NewTitle" myField="my field value" />

Robin

unread,
Apr 23, 2018, 4:11:14 AM4/23/18
to tiddl...@googlegroups.com
I actualy did that too

In the template I created the field city_name
and on the other tiddler I added 

$edit-text tiddler="MyTemplate" field="city_name" default="" placeholder='City name'/>

to get a textbox to fill in the value of that field

<$action-setfield $tiddler="MyTemplate" $field="city_name" $value=""/>
This I added to clear the field for later use see below



<$button>Make Tiddler
<$action-navigate $to={{MyTitle}}/>
<$action-setfield $tiddler='MyTemplate' $field='title' $value={{MyTitle}}/>
<$action-sendmessage $message="tm-edit-tiddler" $param={{MyTitle}}/>
<$action-setfield $tiddler="MyTemplate" $field="city_name" $value=""/>
<$action-deletefield $tiddler=MyTitle text/>
</$button>
<br>


Probably not the most elegant method but it worked for me

after all this I found this example
And I learned a lot from it maybe it is of some use to you.



Ste Wilson

unread,
Apr 23, 2018, 4:32:51 AM4/23/18
to TiddlyWiki
Thank you both for that.
@robin
Of course the solution's on inmysocks...everything is on there :D

Note to self.. Check socks first.

Reply all
Reply to author
Forward
0 new messages