Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions jquery.formtowizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

(function($) {
$.fn.formToWizard = function( options, cmdParam1 ) {
$.fn.formToWizard = function( options, cmdParam1, cmdParam2 ) {
// Stop when selector found nothing!
if (this.length == 0) return this;

Expand Down Expand Up @@ -87,7 +87,7 @@
initCommands();

if( typeof commands[ cmd ] === 'function' ) {
commands[ cmd ]( cmdParam1 );
commands[ cmd ]( cmdParam1, cmdParam2 );
} else {
throw cmd + ' is invalid command!';
}
Expand All @@ -100,17 +100,20 @@
options = $( element ).data( 'options' );

commands = {
GotoStep: function( stepNo ) {
GotoStep: function( stepNo, currentStep ) {
var stepName = "step" + (--stepNo);

if( $( '#' + stepName )[ 0 ] === undefined ) {
throw 'Step No ' + stepNo + ' not found!';
}

if( $( '#' + stepName ).css( 'display' ) === 'none' ) {
$( element ).find( '.stepDetails' ).hide();
$( '#' + stepName ).show();
selectStep( stepNo );
if ( currentStep !== undefined || options.validateBeforeNext(element, $("#" + currentStep)) === true ) {

if( $( '#' + stepName ).css( 'display' ) === 'none' ) {
$( element ).find( '.stepDetails' ).hide();
$( '#' + stepName ).show();
selectStep( stepNo );
}
}
},
NextStep: function() {
Expand Down