mgildea / Multi-Step-Form-Js

Multi Step Form with jQuery validation
MIT License
49 stars 25 forks source link

Jumping to specific step. #26

Closed AllenXavier closed 3 years ago

AllenXavier commented 3 years ago

I want to know if we can make separate buttons to jump to a specific step. (in my example at the end of the form there should be a clickable overview separate from the steps at the top.

I have tried using the following functions:

$('.js-mfs-navigate-2').click(function() { $('.msf:first').setActiveView(2); });


$('.js-mfs-navigate-2').click(function(event, data) { $.tryNavigateToView(data.currentIndex, 2); });

Any help would be greatly appreciated.

Screenshot 2020-12-23 at 12 09 14
lvmajor commented 3 years ago

Its been a while since I looked at this but here ara couple quick things that come to my mind.

  1. Did you initialize with the option allowClickNavigation : true
  2. If so, you could simply simulate the click on the corresponding "MSF-step" button when clicking on your additional buttons.
AllenXavier commented 3 years ago

@lvmajor You are a legend, had not even thought about doing it like that, thanks a lot man.

For people interested this is the eventual code, where step-2 is a class give to that specific msf-step

$('.js-mfs-navigate-2').click(function() { $('.step-2').trigger('click'); });