|
324 | 324 | {
|
325 | 325 | var options = wizard.data("options");
|
326 | 326 | var state = wizard.data("state");
|
| 327 | + var oldIndex = state.currentIndex; |
327 | 328 |
|
328 | 329 | if (index >= 0 && index < state.stepCount && !(options.forceMoveForward && index < state.currentIndex))
|
329 | 330 | {
|
330 | 331 | var anchor = $(".steps a[href$='-" + index + "']", wizard);
|
| 332 | + var isDisabled = anchor.parent().hasClass("disabled"); |
| 333 | + // Remove the class to make the anchor clickable! |
331 | 334 | anchor.parent().removeClass("disabled");
|
332 | 335 | anchor.click();
|
333 | 336 |
|
| 337 | + // An error occured |
| 338 | + if (oldIndex == state.currentIndex && isDisabled) |
| 339 | + { |
| 340 | + // Add the class again to disable the anchor; avoid click action. |
| 341 | + anchor.parent().addClass("disabled"); |
| 342 | + return false; |
| 343 | + } |
| 344 | + |
334 | 345 | return true;
|
335 | 346 | }
|
336 | 347 |
|
|
573 | 584 |
|
574 | 585 | if (options.enablePagination)
|
575 | 586 | {
|
576 |
| - var finish = $(".actions a[href='#finish']", wizard); |
577 |
| - var next = $(".actions a[href='#next']", wizard); |
| 587 | + var finish = $(".actions a[href='#finish']", wizard).parent(); |
| 588 | + var next = $(".actions a[href='#next']", wizard).parent(); |
578 | 589 |
|
579 | 590 | if (!options.forceMoveForward)
|
580 | 591 | {
|
581 |
| - var previous = $(".actions a[href='#previous']", wizard); |
| 592 | + var previous = $(".actions a[href='#previous']", wizard).parent(); |
582 | 593 | if (state.currentIndex > 0)
|
583 | 594 | {
|
584 | 595 | previous.removeClass("disabled");
|
|
611 | 622 | {
|
612 | 623 | if (state.stepCount == 0)
|
613 | 624 | {
|
614 |
| - finish.parent().hide(); |
615 |
| - next.addClass("disabled").parent().show(); |
| 625 | + finish.hide(); |
| 626 | + next.show().addClass("disabled"); |
616 | 627 | }
|
617 | 628 | else if (state.stepCount > 1 && state.stepCount > (state.currentIndex + 1))
|
618 | 629 | {
|
619 |
| - finish.parent().hide(); |
620 |
| - next.removeClass("disabled").parent().show(); |
| 630 | + finish.hide(); |
| 631 | + next.show().removeClass("disabled"); |
621 | 632 | }
|
622 | 633 | else if (!options.enableFinishButton)
|
623 | 634 | {
|
624 | 635 | next.addClass("disabled");
|
625 | 636 | }
|
626 | 637 | else
|
627 | 638 | {
|
628 |
| - finish.parent().show(); |
629 |
| - next.removeClass("disabled").parent().hide(); |
| 639 | + finish.show(); |
| 640 | + next.hide().removeClass("disabled"); |
630 | 641 | }
|
631 | 642 | }
|
632 | 643 | }
|
|
0 commit comments