Wiki source code of Confirmation Box UI Component

Version 10.1 by Jerome on 2009/10/09

Show last authors
1 {{toc start=2 /}}
2
3 The Confirmation Box UI is an alternative to the old-fashioned browsers confirm boxes. It displays a nice popup box asking the user to confirm an action. Functions hooks are available on both confirm and cancel actions.
4
5 //The default confirmation box in action : //
6 image:confirmbox.png
7
8 == Usage ==
9
10 {{code language="javascript"}}
11 new XWiki.widgets.ConfirmationBox(behavior, interactionParameters);
12 {{/code}}
13
14 ; behavior
15 : Object that define confirm and cancel handlers. When the user chooses "Yes", its "onYes" method is triggered if it exists. When the user chooses "No", its "onNo" method is triggered, if it exists. The behavior parameter is not mandatory and is empty by default (It means nothing will happen upon confirmation or cancel).
16
17 Example :
18
19 {{code language="javascript"}}
20 var myBehavior = {
21 onYes: function() {
22 alert("Yes !");
23 },
24 onNo: function() {
25 alert("Oh no :(");
26 }
27 };
28 {{/code}}
29
30 ; interactionParameters
31 : Object that defines the different text elements displayed with-in the confirmation box. Three variables are available for customization : **confirmationText**, the message to confirm (default value for the English language is //Are you sure ?//), **yesButtonText** the "yes" button text (or confirm button), **noButtonText** the "no" button text (or cancel button).
32
33 Example :
34
35 {{code language="javascript"}}
36 var myInteractionParamters = {
37 confirmationText: "Are you sure you want to engage the wiki's self-destruction process ?",
38 yesButtonText: "Yes, please do that",
39 noButtonText: "No thank you"
40 };
41 {{/code}}
42
43 == Source Code (for tag xwiki-web-2.0) ==
44
45 {{remotecode language="javascript" source="http://svn.xwiki.org/svnroot/xwiki/platform/web/tags/xwiki-web-2.0/standard/src/main/webapp/resources/uicomponents/widgets/confirmationBox.js" /}}

Get Connected