@@ -440,25 +440,30 @@ function goToStep(wizard, options, state, index)
440
440
}
441
441
442
442
var oldIndex = state . currentIndex ;
443
- if ( wizard . triggerHandler ( "stepChanging" , [ state . currentIndex , index ] ) )
444
- {
445
- // Save new state
446
- state . currentIndex = index ;
447
- saveCurrentStateToCookie ( wizard , options , state ) ;
448
-
449
- // Change visualisation
450
- refreshStepNavigation ( wizard , options , state , oldIndex ) ;
451
- refreshPagination ( wizard , options , state ) ;
452
- loadAsyncContent ( wizard , options , state ) ;
453
- startTransitionEffect ( wizard , options , state , index , oldIndex , function ( )
454
- {
443
+ //
444
+ var ajax = wizard . triggerHandler ( "stepChanging" , [ state . currentIndex , index ] ) ;
445
+
446
+ jQuery . when ( ajax )
447
+ . done ( function ( status ) {
448
+ if ( status !== false ) {
449
+ // Save new state
450
+ state . currentIndex = index ;
451
+ saveCurrentStateToCookie ( wizard , options , state ) ;
452
+
453
+ // Change visualisation
454
+ refreshStepNavigation ( wizard , options , state , oldIndex ) ;
455
+ refreshPagination ( wizard , options , state ) ;
456
+ loadAsyncContent ( wizard , options , state ) ;
457
+ startTransitionEffect ( wizard , options , state , index , oldIndex , function ( ) {
455
458
wizard . triggerHandler ( "stepChanged" , [ index , oldIndex ] ) ;
456
- } ) ;
457
- }
458
- else
459
- {
459
+ } ) ;
460
+ } else {
461
+ wizard . find ( ".steps li" ) . eq ( oldIndex ) . addClass ( "error" ) ;
462
+ }
463
+ } )
464
+ . fail ( function ( ) {
460
465
wizard . find ( ".steps li" ) . eq ( oldIndex ) . addClass ( "error" ) ;
461
- }
466
+ } ) ;
462
467
463
468
return true ;
464
469
}
0 commit comments