Show last authors
1 {{toc/}}
2
3 {{warning}}
4 Note that for UI consistency point of view, we advise you to prefer using the Bootsrap Modal than this UI Component, in particularly for XWiki Standard development.
5 {{/warning}}
6
7 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.
8
9 //Image of the confirmation box in action~://
10 image:confirmbox.png
11
12 {{html}}
13 <a href="#" onclick="javascript:new XWiki.widgets.ConfirmationBox();">Or click this link to see one live!</a>
14 {{/html}}
15
16 = Usage =
17
18 {{code language="javascript"}}
19 new XWiki.widgets.ConfirmationBox(behavior, interactionParameters);
20 {{/code}}
21
22 ; behavior
23 : \\
24
25 (((
26 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. When the user chooses "Cancel", if the cancel button is enabled, its "onCancel" 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).
27
28 Example:
29
30 {{code language="javascript"}}
31 var myBehavior = {
32 onYes: function() {
33 alert("Yes!");
34 },
35 onNo: function() {
36 alert("Oh no :(");
37 }
38 };
39 {{/code}}
40 )))
41
42 ; interactionParameters
43 : \\
44
45 (((
46 Object that defines the different text elements displayed within the confirmation box. Five 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, **cancelButtonText** - the "cancel" button text, if enabled, and **showCancelButton** - whether to show the cancel button, disabled by default.
47
48 Example :
49
50 {{code language="javascript"}}
51 var myInteractionParameters = {
52 confirmationText: "Are you sure you want to engage the wiki's self-destruction process?",
53 yesButtonText: "Yes, please do that",
54 noButtonText: "No thank you"
55 };
56 {{/code}}
57 )))
58
59 = Source Code =
60
61 {{remotecode source="https://raw.github.com/xwiki/xwiki-platform/xwiki-platform-5.4.5/xwiki-platform-core/xwiki-platform-web/src/main/webapp/resources/uicomponents/widgets/confirmationBox.js"/}}
62
63 = Tips =
64
65 Check out the Javascript code:
66
67 * [[for your wiki instance>>http://localhost:8080/xwiki/bin/skin/resources/uicomponents/widgets/confirmationBox.js||rel="__blank"]]
68 * [[from GitHub (for tag xwiki-platform-3.4)>>https://github.com/xwiki/xwiki-platform/blob/xwiki-platform-3.4/xwiki-platform-core/xwiki-platform-web/src/main/webapp/resources/uicomponents/widgets/confirmationBox.js||rel="__blank"]]

Get Connected