1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-28 11:00:27 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/widgets/ActionDeleteFieldWidget.tid

77 lines
3.4 KiB
Plaintext

caption: action-deletefield
created: 20141025120850184
modified: 20240608151322035
tags: Widgets ActionWidgets
title: ActionDeleteFieldWidget
type: text/vnd.tiddlywiki
! Introduction
The ''action-deletefield'' widget is an [[action widget|ActionWidgets]] that deletes specified fields of a tiddler. ActionWidgets are used within triggering widgets such as the ButtonWidget.
! Content and Attributes
The ''action-deletefield'' widget is invisible. Any content within it is ignored.
|!Attribute |!Description |
|$tiddler |The title of the tiddler whose fields are to be modified (if not provided defaults to the [[current tiddler|Current Tiddler]]) |
|$field |Optional name of a field to delete |
|$timestamp |<<.from-version "5.3.4">> Specifies 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" |
|//{any attributes not starting with $}// |Each attribute name specifies a field to be deleted. The attribute value is ignored and need not be specified |
! Examples
<$testcase>
<$data title=Description text="Delete currentTiddler fields using plain attributes"/>
<$data title=Narrative text="""Use the $action-deletefield widget to delete the "caption" and "tags" fields of the current tiddler"""/>
<$data title=Output caption="A caption" tags="tag1 tag2 tag3" text="""Click
<$button actions="<$action-deletefield caption tags/>">
Delete
</$button>
and watch the "caption" and "tags" field disappear."""/>
</$testcase>
<$testcase>
<$data title=Description text="Delete fields from a specific tiddler"/>
<$data title=Narrative text="""Use the $action-deletefield widget to delete the "list" and "tags" fields of the tiddler ~HelloThere"""/>
<$data $tiddler="HelloThere"/>
<$data title=Output text="""Click HelloThere, then click
<$button actions='<$action-deletefield $tiddler="HelloThere" list tags/>'>
Delete
</$button>
and watch the "list" and "tags" fields disappear"""/>
</$testcase>
<$testcase>
<$data title=Description text="Delete field from a specific tiddler"/>
<$data title=Narrative text="""Use the $field attribute of the $action-deletefield widget to delete the "text" field of the tiddler ~HelloThere"""/>
<$data $tiddler="HelloThere"/>
<$data title=Output text="""Click HelloThere, then click
<$button actions='<$action-deletefield $tiddler="HelloThere" $field="text"/>'>
Delete
</$button>
and watch the contents of the "text" field disappear"""/>
</$testcase>
<$testcase>
<$data title=Description text="Delete a variable field name"/>
<$data title=Narrative text="""Use the $field attribute of the $action-deletefield widget to delete a variable field name"""/>
<$data title=Output description="This field will be deleted" text="""<$let fieldName=description>
Click
<$button actions="<$action-deletefield $field=<<fieldName>>/>">
Delete
</$button>
and watch the "<<fieldName>>" field disappear."""/>
</$let>
</$testcase>
<$testcase>
<$data title=Description text="Delete field without updating timestamps"/>
<$data title=Narrative text="""Use the $timestamp attribute of the $action-deletefield widget to prevent creation/change of "modified" and "created" fields"""/>
<$data title=Output description="This field will be deleted" text="""Click
<$button actions='<$action-deletefield $field="description" $timestamp="no"/>'>
Delete
</$button>
and watch the "description" field disappear without the "modified" and "created" fields getting added"""/>
</$testcase>