This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

ActionCreateTiddlerWidget

31st January 2020 at 3:18pm
ActionWidgets Widgets

Introduction

The action-createtiddler widget is an action widget that creates new tiddlers. ActionWidgets are used within triggering widgets such as the ButtonWidget.

There are several differences from the tm-new-tiddler message:

  • The new tiddler is not automatically displayed in the story river
  • The title of the new tiddler is made available for subsequent operations

Content and Attributes

The action-createtiddler widget is invisible. Any content within it is ignored.

AttributeDescription
$basetitleThe initial title that will be attempted. If a tiddler with that title already exists, then a numerical counter is added to the title and incremented until it is unique
$savetitleA text reference identifying a field or index into which the title of the newly created tiddler will be stored after it is created
$savedrafttitle New in: 5.1.20 A text reference identifying a field or index into which the draft title associated with the newly created tiddler will be stored after it is created. This is useful when using a sequence of action widgets to create a new tiddler, put it into edit mode, and position it within the list of its parent tag
$timestampSpecifies whether the timestamp(s) of the target tiddler will be updated (modified and modifier, plus created and creator for newly created tiddlers). Can be "yes" (the default) or "no"
$template New in: 5.1.22 The title of a template tiddler, that will be used to create a new tiddler
$overwrite New in: 5.1.22 If set to "yes", it will overwrite existing tiddlers. Be careful!
{any attributes not starting with $}Each attribute name specifies a field to be created in the new tiddler

Examples

New button caption: <$edit-text tiddler="$:/state/new-button-caption" tag="input" default=""/>

<$button>
<$action-createtiddler $basetitle="Homemade Button" tags="$:/tags/PageControls" text={{$:/state/new-button-caption}}/>
Create non-functional page control button
</$button>

That renders as:

New button caption:


This example will create "New Tiddler", "New Tiddler 1", " New Tiddler 2" and so on

\define testCreate()
<$action-createtiddler />
\end

<$button actions=<<testCreate>> >
Create Tiddler
</$button>

- Clicking this button, will also open the Right sidebar: Recent tab


This example will use the base title defined in $:/language/DefaultNewTiddlerTitle.

It will overwrite the tiddler, if the button is clicked several times.

\define testCreate()
<$action-createtiddler $basetitle={{$:/language/DefaultNewTiddlerTitle}} $overwrite="yes"/>
\end

<$button actions=<<testCreate>> >
Create Tiddler
</$button>

- Clicking this button, will also open the Right sidebar: Recent tab


This example will uses a base-title and a template: ActionCreateTiddlerWidget Template

It will create: "base", "base 1", "base 2" and so on

\define testCreate()
<$action-createtiddler $basetitle="base" $template="ActionCreateTiddlerWidget Template"/>
\end

<$button actions=<<testCreate>> >
Create Tiddler
</$button>

- Clicking this button, will also open the Right sidebar: Recent tab


This example will uses a base-title: "base" and a template: ActionCreateTiddlerWidget Template.

There will be new fields "aa" and "bb" which are added to the new tiddlers.

\define testCreate()
<$action-createtiddler $basetitle="base" $template="ActionCreateTiddlerWidget Template" aa="new field aa" bb="new field bb" />
\end

<$button actions=<<testCreate>> >
Create Tiddler
</$button>

- Clicking this button, will also open the Right sidebar: Recent tab