# jQuery Smart Wizard Version 3 and later at http://mstratman.github.com/jQuery-Smart-Wizard/ Original version 2 and earlier are from http://www.techlaboratory.net/products.php?product=smartwizard Licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. http://creativecommons.org/licenses/by-sa/3.0/ ## Getting Started Basic Usage: ```javascript $('#wizard').smartWizard(); ``` Using with option parameters: ```javascript $('#wizard').smartWizard({ // Properties selected: 0, // Selected Step, 0 = first step keyNavigation: true, // Enable/Disable key navigation(left and right keys are used if enabled) enableAllSteps: false, // Enable/Disable all steps on first load transitionEffect: 'fade', // Effect on navigation, none/fade/slide/slideleft contentURL:null, // specifying content url enables ajax content loading contentURLData:null, // override ajax query parameters contentCache:true, // cache step contents, if false content is fetched always from ajax url cycleSteps: false, // cycle step navigation enableFinishButton: false, // makes finish button enabled always hideButtonsOnDisabled: false, // when the previous/next/finish buttons are disabled, hide them instead errorSteps:[], // array of step numbers to highlighting as error steps labelNext:'Next', // label for Next button labelPrevious:'Previous', // label for Previous button labelFinish:'Finish', // label for Finish button noForwardJumping:false, // Events onLeaveStep: null, // triggers when leaving a step onShowStep: null, // triggers when showing a step onFinish: null // triggers when Finish button is clicked }); ``` Parameters and Events are describing on the table below. ## Installing Smart Wizard 3 ### Step 1: Include Files Include the following JavaScript and css files on your page. 1. jQuery Library file (Don't include if you already have it on your page) 2. CSS(Style Sheet) file for Smart Wizard 3. JavaScript plug-in file for Smart Wizard To include the files copy and paste the below lines inside the head tag (`
`) of your page. Make sure the paths to the files are correct with your working environment. ```html ``` ### Step 2: The JavaScript Inititialize the Smart Wizard, copy and paste the below lines inside the head tag (` `) of your page ```html ``` ### Step 3: The HTML Finally the html, below shows the HTML markup for the Smart Wizard, You can customize it by including your on contents for each steps. Copy and paste the below html inside the body tag (``) of your page. ```htmlParameter Name | Description | Values | Default Value |
---|---|---|---|
selected | specify the initially-selected step | integer | 0 |
keyNavigation |
enable/disable key navigation.
left/right keys are used if enabled |
true = enabled
false= disabled |
true |
enableAllSteps | Enable/Disable all steps on first load |
true = enabled
false= disabled |
false |
transitionEffect | Animation effect on step navigation | none/fade/slide/slideleft | fade |
contentURL | Setting this property will enable ajax content loading, setting null will disable ajax contents | null or a valid url | null |
contentURLData | with ContentURL set, use this property to override the ajax query parameters used when loading contents | null or a function that takes the new step number and returns an object to override ajax parameters | null |
contentCache | This property will enable caching of the content on ajax content mode. So the contents are fetched from the url only on first load of the step |
true = enabled
false= disabled |
true |
cycleSteps | This property allows to cycle the navigation of steps |
true = enabled
false= disabled |
false |
enableFinishButton | This property will make the finish button enabled always |
true = enabled
false= disabled |
false |
hideButtonsOnDisabled | This property will hide the disabled buttons instead of just disabling them |
true = enabled
false= disabled |
false |
errorSteps | an array of step numbers to highlighting as error steps |
array of integers
ex: [2,4] |
[] |
labelNext | Label for Next button | String | Next |
labelPrevious | Label for Previous button | String | Previous |
labelFinish | Label for Finish button | String | Finish |
noForwardJumping | If true, automatically disable all steps following the current step.
e.g. If I am on step 4, and click step 1, steps 2-4 will be disabled and I cannot jump back to 3 or 4, and can only proceed "next" to step 2. |
Boolean | false |
Event Name | Description | Parameters |
---|---|---|
onLeaveStep |
Triggers when leaving a step.
This is a decision making event, based on its function return value (true/false) the current step navigation can be cancelled. |
Object: object of the step anchor element.
You can access the step number and step body element using this object.
Object: Context information with keys: fromStep and toStep |
onShowStep | Triggers when showing a step. |
Object: object of the step anchor element.
You can access the step number and step body element using this object.
Object: Context information with keys: fromStep and toStep |
onFinish |
Triggers when the Finish button is clicked.
This is a decision making event, based on its function return value (true/false) the further actions can be cancelled. e.g.: If the validation fails we can cancel form submitting and can show an error message. Please see the form validation example for the implementation If this callback is not set, clicking the finish button will submit the form in which the wizard is placed, and do nothing if a parent form is not found. |
Object Array: an array of the object of all the step anchor elements Object: Context information with key: fromStep indicating which step the user was on when they clicked the finish button. |
Method Name | Arguments | Description |
---|---|---|
showMessage | String: the message to show. | Show a message in the action bar |
hideMessage | None | Hide the message in the action bar |
showError | Integer: the step number to highlight with an error. | This is a convenience wrapper around setError. |
hideError | Integer: the step number to un-highlight with an error. | This is a convenience wrapper around setError. |
setError | Object: with keys stepnum and iserror. | Set or unset error status on a particular step. Passing iserror as true sets the error. Passing in a false value turns off the error. |
goForward | None | Load the next step. |
goBackward | None | Load the previous step. |
goToStep | Integer - the step number to load | Load the specified step. |
enableStep | Integer - the step number to enable | Enable the specified step. |
disableStep | Integer - the step number to disable | Disable the specified step. |
currentStep | None | Returns the number of the current step. |
fixHeight | None | Adjusts the height of the step contents for the current step. In general you won't need this, but it's useful if you are dynamically setting the contents. |