Introduction
Introduced in v5.1.23The action-confirm widget is an action widget that prompts the user for confirmation and invokes other action widgets contained within it only if the user confirms. ActionWidgets are used within triggering widgets such as the ButtonWidget.
Content and Attributes
The action-confirm widget is invisible. Any content within it is only processed if the user confirms the action, or the confirmation has been disabled by the $prompt
attribute.
Attribute | Description |
---|---|
$message | Optional message displayed to the user when asking for confirmation. |
$prompt | Optional flag, set to "no" to disable the prompt for confirmation. Defaults to "yes" |
Examples
Here is an example of a button that asks the user for confirmation, before deleting the caption and tags fields of the current tiddler:
<$button>
<$action-confirm $message="Do you wish to delete the caption and tags?">
<$action-deletefield caption tags/>
Delete "caption" and "tags"
</$action-confirm>
</$button>
That renders as:
Here is an example of a button that uses the optional $prompt
attribute to control whether to prompt the user before deleting the text field of the tiddler HelloThere:
<$button>
<$action-confirm $message="Do you wish to delete the text field?" $prompt={{$:/state/promptUser}}>
<$action-deletefield $tiddler="HelloThere" $field="text"/>
</$action-confirm>
Delete text from ~HelloThere
</$button>
That renders as: