This element is used to construct a step-by-step wizard found in some applications to guide users through a task. It is used for a window with several steps contained on several pages. This element provides the header and buttons along the bottom, and also handles navigation between the pages. Each page should be constructed using a wizardpage
. The pages are displayed in the order that they are placed in the wizard
, unless you use the next
and pageid
attributes on the pages to change the sequence. The wizard will rendered in a manner suitable for the user's selected theme and platform. In newer versions of Mozilla, a statusbar
may be placed directly inside the wizard element which will be shared among all pages.
More information is available in the XUL tutorial.
- Attributes
- firstpage, lastpage, onextra1, onextra2, onwizardback, onwizardcancel, onwizardfinish, onwizardnext, pagestep, title, windowtype
- Properties
- canAdvance, canRewind, currentPage, onFirstPage, onLastPage, pageCount, pageIndex, pageStep, title, wizardPages
Examples
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <wizard id="theWizard" title="Secret Code Wizard" xmlns="https://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> function checkCode(){ document.getElementById('theWizard').canAdvance = (document.getElementById('secretCode').value == "cabbage"); } </script> <wizardpage onpageshow="checkCode();"> <label value="Enter the secret code:"/> <textbox id="secretCode" onkeyup="checkCode();"/> </wizardpage> <wizardpage> <label value="That is the correct secret code."/> </wizardpage> </wizard>
Attributes
activetitlebarcolor
- Type: color string
- Specify background color of the window's titlebar when it is active (foreground). Moreover this hides separator between titlebar and window contents. This only affects Mac OS X.
-
inactivetitlebarcolor
- Type: color string
- Specify background color of the window's titlebar when it is inactive (background). Moreover this hides separator between titlebar and window contents. This affects only on Mac OS X.
-
onextra1
- Type: script code
- This should be set to code which is called when the user presses the extra1 button.
-
onextra2
- Type: script code
- This should be set to code which is called when the user presses the extra2 button.
-
onwizardback
- Type: script code
- This should be set to code which is called when the user presses the Back button. Return
true
to allow the previous page to be displayed andfalse
to disallow moving back a page. Use thecanRewind
property to indicate to the user (by disabling the Back button) that they cannot go back a page.
-
onwizardcancel
- Type: script code
-
This should be set to code which is called when the user presses the Cancel button. Return
true
to allow the wizard to be canceled, and close the wizard, or returnfalse
to prevent the wizard from being canceled.Use thecanCancel
property to indicate to the user (by disabling the Cancel button) that they cannot cancel.
-
onwizardfinish
- Type: script code
- This should be set to code which is called when the user presses the Finish button, which would appear in place of the Next button on the last page of the wizard. Return
true
to allow the wizard to be closed, accepting any values entered on the pages, or returnfalse
to prevent the wizard from being closed. Use thecanAdvance
property to indicate to the user (by disabling the Finish button) that they cannot end the wizard.
-
onwizardnext
- Type: script code
- This should be set to code which is called when the user presses the Next button. Return
true
to allow the next page to be displayed andfalse
to disallow moving to the next page. Use thecanAdvance
property to indicate to the user (by disabling the Next button) that they cannot go to the next page.
-
pagestep
- Type: integer
- The index of the current page.
-
title
- Type: string
- The text to appear in the title bar of the window.
-
windowtype
- Type: string
- Set to a string which can be used to identify the type of window. This might be used, for example, to distinguish between a browser window and an editor window. Some of Mozilla's window handling functions use this attribute to group windows of the same type together.
Values for window type as found on MXR: https://mxr.mozilla.org/mozilla-release/search?string=windowtype
navigator:browser - Looks like if window has gBrowser it has this window type
devtools:scratchpad - Scratchpad windows
navigator:view-source - The view source windows
Properties
-
canAdvance
- Type: boolean
- This property is set to
true
if the user can press the Next button to go to the next page. If this property isfalse
, the user cannot navigate to the next page. Set this property totrue
to indicate that the user can go to the next page. Set tofalse
to disallow moving to the next page. This has the effect of enabling or disabling the Next button, or, on the last page of the wizard, the Finish button.
-
canRewind
- Type: boolean
-
This property is set to
true
if the user can press the Back button to go to the previous page. If this property isfalse
, the user cannot navigate to the previous page. Set this property totrue
to indicate that the user can go back a page. Set tofalse
to disallow moving to the previous page. This has the effect of enabling or disabling the Back button.
-
currentPage
- Type:
wizardpage
element - This property returns the
wizardpage
element that is currently displayed. You can modify this value to change the current page.
-
onFirstPage
- Type: boolean
- This property is set to
true
if the user is on the first page, which may or may not be the first index.
-
onLastPage
- Type: boolean
- This property is set to
true
if the user is on the last page of the wizard.
-
pageIndex
- Type: integer
- This property returns the index of the currently selected page. You can change the selected page by modifying this property.
-
pageStep
- Type: integer
- This property returns the number of pages that the user has navigated through so far, meaning that the user would press the Back button this many times to go back to the beginning. This property is different than
pageIndex
, because pages are not necessarily navigated in order.
-
wizardPages
- Type: DOM NodeList of
wizardpage
elements - This property holds the list of
wizardpage
elements in thewizard
.
Methods
-
advance( pageID )
- Return type: no return value
-
Call this method to go to the next page. This is equivalent to pressing the Next button. The
canAdvance
property must be set totrue
for the page to be changed. The code in theonwizardnext
attribute is called before the page is changed. The pageID argument allows you to specify the index of the page to which to jump. Supplynull
as the argument to go to the next page in the sequence.
-
cancel()
- Return type: no return value
- Call this method to cancel and close the wizard. The code in the
attribute is called before the wizard is cancelled.onwizardcancel
-
extra1()
- Return type: no return value
- Call this method to simulate clicking the extra1 button. The code in the
onextra1
attribute is called.
-
extra2()
- Return type: no return value
- Call this method to simulate clicking the extra2 button. The code in the
onextra2
attribute is called.
-
getButton( type )
- Return type: button element
- Returns the
button
element in the dialog corresponding to the given type.
-
getPageById( pageID )
- Return type:
wizardpage
element - Returns the
wizardpage
element corresponding to the specified <var>pageID</var>.
-
goTo( pageID )
- Return type: no return value
- This method is used to change which page is currently displayed, specified by the <var>pageID</var> argument. The page will be changed regardless of the value of
canAdvance
orcanRewind
. Theonwizardback
andonwizardnext
code is not called when using this function.
-
rewind()
- Return type: no return value
- Call this method to go back a page. It is equivalent to pressing the Back button. The
canRewind
property must be set totrue
for the page to be changed. The code in theonwizardback
attribute is called before the page is changed.