std:ui:confirm
This template renders a simple confirmation form, with each choice represented as a submit button in a form which POSTs to a given URL, with an optional cancel link.
Obtain a Template
object with P.template("std:ui:confirm")
, or use the template:std:ui:confirm()
template function.
See also the std:ui:choose
template, which may be more appropriate for simple choices.
Note that this template simply generates HTML forms, so any actions
and parameters
are subject to client side manipulation, just like any other form.
This template uses the standard backLink
and backLinkText
view properties to automatically use the same link and text as the ‘Back’ link. Where you want to use different values, use the within() template function to move the view into a new context.
View
key text
Optional. The text of the confirmation message, rendered using the std:text:paragraph() template function.
If you need anything more complicated, use this template as a partial and render your own message.
key backLink
Optional. The URL for the cancel link.
This property is called backLink
so if you use this as the main template for your page, you’ll automatically get the standard back link displayed in the top left. See note about within()
above.
key backLinkText
Optional. The text for the cancel link, defaulting to "Cancel"
. See note about within()
above.
key options
An array of options, each of which is rendered as an HTML form submit button. It has keys:
action |
The URL for the action attribute of the form. The generated forms always have a "POST" method. |
label |
The label for the submit button. |
parameters |
(Optional) A dictionary of name/value pairs for hidden input fields in the form, useful for passing parameters to your handlers. |
Example
P.respond("GET", "/do/example/send", [ ], function(E) { E.render({ pageTitle: "Send event notification", backLink: "/do/example/main", text: "Would you like to notify your customer?", options: [ { action: "/do/example/notify", label: "Notify now" }, { action: "/do/example/notify", label: "Postpone notification" parameters: { "postpone": "yes" } } ] }, "std:ui:confirm"); });