User confirm: Difference between revisions
Jump to navigation
Jump to search
imported>StDoodle m moved User confirm() to User confirm |
imported>StDoodle No edit summary |
||
Line 1: | Line 1: | ||
{{#vardefine:name|user_confirm}} | |||
{{#vardefine:return_type|boolean}} | |||
{{FunctionPage| | |||
name={{#var:name}}| | |||
function_category=Miscellaneous| | |||
function1={{Function| | |||
name={{#var:name}}| | |||
aggregate={{#var:aggregate}}| | |||
return_type={{#var:return_type}}| | |||
return_also={{#var:return_also}}| | |||
parameter1={{Param|string|message}}| | |||
p1desc={{pspan|message}} is the text to display in the confirmation pop-up| | |||
}}| | |||
function_description=Presents the user with a pop-up dialog box with the text in {{pspan|message}} (can use escaped characters, such as "<nowiki>\n</nowiki>" for a newline); returns true if the user selects "Yes" and false if the user selects "No."</p> | |||
<p>Please use these sparingly, as it can defeat the purpose of scripting if the user must constantly provide information during execution.| | |||
code1={{CodeSample| | |||
title=Code Sample| | |||
description=A check to see if the user truly wants to execute a script.| | |||
code= | |||
<syntaxhighlight> | |||
if (!user_confirm("Are you sure you want to proceed with executing this script?") { | |||
abort("Script execution canceled by user."); | |||
</syntaxhighlight>}}| | |||
}} |
Revision as of 19:32, 4 March 2010
Function Syntax
boolean user_confirm(string message )
- message is the text to display in the confirmation pop-up
Presents the user with a pop-up dialog box with the text in message (can use escaped characters, such as "\n" for a newline); returns true if the user selects "Yes" and false if the user selects "No."
Please use these sparingly, as it can defeat the purpose of scripting if the user must constantly provide information during execution.
Code Sample
A check to see if the user truly wants to execute a script.
if (!user_confirm("Are you sure you want to proceed with executing this script?") {
abort("Script execution canceled by user.");