jQuery Stepy – A Wizard Plugin

jQuery Stepy is a plugin based on FormToWizard that generates a customizable wizard. (Demo)

Required files:

+ jquery.stepy.min.js
+ jquery.stepy.css

Default configuration:
$('#step').stepy();
<form id="step">
  <fieldset title="Title">
    <legend>description</legend>
    <!-- input fields -->
  </fieldset>

  <fieldset title="Title">
    <legend>description</legend>
    <!-- input fields -->
  </fieldset>

  <input type="submit" class="finish"/>
</form>
Demo:

http://wbotelhos.com/stepy

Please:

- Format your code before paste it here, I will probably have to read it;
- Use code formatter to write it:

[source language="javascript"]your_code_here[/source]

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
  • Xtyan

    May 2nd, 2012

    Reply

    Hi, I’m using stepy and it is working great.

    I would like to exec fnStepy_GO, only if all fields of current step are valid. Now, after execute this function the errors are showed.
    How do i do that?

        next: function(Index) {
            fnStepy_GO(Index);
        },
    
    • wbotelhos

      May 5th, 2012

      Reply

      Hi Xtyan,

      If the step is valid then it will go to the next step, then you can put your function inside the ‘select’ callback.

  • karl

    March 1st, 2012

    Reply

    Hey marco,

    I love your steppy plugin it is amazing and has done everything I need it to do, I just wanted to ask if you could give me an example as im a real newb when it comes to this stuff. of how I would test to see when the 2nd step is visable and then run a select stament when it loads. the reason I ask this is because I need to do a select from my db and the select statement needs to be based on a selection that is on the first step. any help would be greatly appreciated!

    Thanks so much for your time i look forward to your reply.

    • wbotelhos

      March 1st, 2012

      Reply

      Hi karl,

      My name is Washington. :P
      You can to use the callbacks next(index) { } or select(index) { } and get the argument index to know the next step or the current one.

      • Karl

        March 1st, 2012

        Reply

        Hey Washington :P, sorry about the name.

        Could you give me a example of what i am wanting to do i have been triyng it from all sorts of ways and just cant get it .

        what i have so far is here
        show step 1 – perfect
        Then I want to test when the 2nd step is loaded then alert something
        then 3 … dosnt matter.

        Thnaks Heaps

  • inalgnu

    February 22nd, 2012

    Reply

    The demo is not working on IE7, any solution? this will be fixed?

    • wbotelhos

      May 5th, 2012

      Reply

      Hi inalgnu,

      I did not check it up.
      Could you open an issue for me not forget it?

  • Thiago Montovaneli Albertino

    February 10th, 2012

    Reply

    E aê, fí…blz?

    Esse wizard vai quebrar um galhão … mas preciso confirmar se tem como fazer com que cada etapa do wizard seja carregada sobre demanda. Imagine que cada etapa seja um fragmento de página e essas devem ser carregadas somente quando o foco for para sua etapa. Tem como?

    Abraço, parabéns!

    • wbotelhos

      February 10th, 2012

      Reply

      Fala Thiago,

      Você precisa de no mínimo saber quantos passos terá, pois só assim serão criado os links e botões.
      O conteúdo poderá ser carregado no callback select, executado assim que o step é selecionado.

  • Michael

    January 8th, 2012

    Reply

    I am using the code from the jQuery iFrame Sizing tutorial (http://sonspring.com/journal/jquery-iframe-sizing) to auto-size the iframes on my page; however, it does not appear to be functioning properly within Stepy.

    On my application, the jQuery sets the inline style height to “0″ when I look at the code in Firebug.

    Here is an example: http://jsfiddle.net/wvkfn/3/

    If you look at the HTML in the example, Step 2 has an iframe in it (which is not displaying). If you remove the code to load Stepy, it appears correctly.

    Any ideas why this is happening?

    • wbotelhos

      February 5th, 2012

      Reply

      Hi Michael,

      The problem is that your script is running before Stepy get ready. You can create a callback within the Stepy to run your code. Or wait still later to run your script.

  • Tanae Akihiko

    January 4th, 2012

    Reply

    Thanks for a nice plugin. We use it in user’s inquiry form. No Problem in displaying Japanese characters (UTF-8).

    • wbotelhos

      February 5th, 2012

      Reply

      Hi Tanae,

      Good to hear that.
      If you want, send me the link and I add it to the “who” area on site.

  • MyP

    December 29th, 2011

    Reply

    Hello, the plugin works great but there is an error in an initialization function that causes Jquery not working in Internet Explorer 7, to solve the problem, we must remove the comma. The function is $ (‘# custom’). Validate and must be changed:
    ‘day’: {required: ‘field is required Day!’ },
    by
    ‘day’: {required: ‘field is required Day!’ }

    • wbotelhos

      December 29th, 2011

      Reply

      Hi MyP,

      Thanks for the information.
      What do you think about a pull request fixing it? (:

  • Wout

    December 5th, 2011

    Reply

    Hello,

    The last zip works well for the step validator so far. Thank you!

    Regards Wout

  • Wout

    December 4th, 2011

    Reply

    Hello,
    I’m trying to implement the form validation steps.
    When I make 4 steps in stead of 3 the form stopped at step 3. I’m not so familar with jquery. Do you know what I do have to change. I have to put 6 steps in the form. Thanks.

    Sorry for my English, Wout from the Netherlands

  • Michael

    November 27th, 2011

    Reply

    Is there a way to pull the value of the “current” step from the plugin?

    I am using Stepy to dynamically create forms, and the site is setup so the user can leave the form from from a step, but I’d like to have a variable set, so that when they complete an additional task, it takes them back to the last step they were on.

    Is something like this possible?

    • wbotelhos

      November 27th, 2011

      Reply

      Hi Michael,

      The last fix, worked?

      You have the index in the click callback to know which step you are.
      You have the data in the form as well, then just manipulate it with jQuery.

      Maybe jQuery Cookie helps you with the data.

  • Mike

    November 25th, 2011

    Reply

    I have been using your Stepy plugin, and love it! :)

    I am running into an issue however with multiple radio buttons. I posted my issue on StackOverflow:

    http://stackoverflow.com/questions/8271295/how-to-fix-radio-button-validation-between-steps-in-jquery-plugin

    Any ideas on why this is happening?

  • mauricio

    November 10th, 2011

    Reply

    hi stepy is great , but im new with jquery and im making a form with 4 step in the step 3 i want to upload some pic in a flash form and i had a link
    a href=”#” onClick=”document.getElementById(‘agileUploaderSWF’).submit();”>add pics

    which it works but i wish to call this function when hit the next on the third step and validate
    i try searching for the index like this

    $('#custom').stepy({
        onNext: function(index) {
            if (index == 3) {
                document.getElementById('agileUploaderSWF').submit();
            }
      }
    

    but doesn´t work and also on the finish step a want to post action to and another url
    please help!!!
    thank MG

    • wbotelhos

      November 13th, 2011

      Reply

      Hi Maurício,

      First all, try to use the last version of Stepy, then you should try onNext to just next.
      If you submit your form without ajax, the page will be refreshed and the step will back to first, then use ajax.
      To change you url on last step you must change the action of the form with jQuery, it is not a job for Stepy.

  • Michael

    October 17th, 2011

    Reply

    This is a GREAT plugin! I have one, probably stupid, question.

    I am confused how to use the public function:

    $.fn.stepy.step(2, ‘#stepy’);

    I want to have a link elsewhere on the page that will allow the user to jump to a step midway through the form. How do I call this function with a link?

    Also, is it possible to have a link on a separate page, that when clicked will take the user to the page with the form at a specific step?

    Thanks for your help!

    • wbotelhos

      October 17th, 2011

      Reply

      Hi Michael,

      Thanks. You can use:

      function goToStep(index) {
          $.fn.stepy.step(2, ‘#stepy’);
      }
      
       <a href="javascript:void(0);" onclick="goToStep(2);">Step 2</a>
      

      You can pass a parameter on URL and based on that parameter call the function goToStep().

      • Michael

        November 26th, 2011

        Reply

        I’m not sure I follow. What if I am on a separate page? Can I pass a GET parameter? How would this work?

        • wbotelhos

          November 26th, 2011

          Reply

          Hi Michal,

          You can pass a parameter then on your next page check this parameter and call the function:

          $('#step').stepy('step', paramNumber);
          

          Could you open a issue to create param like stepy=1 to go to a specific step, here [1] please?

          [1] https://github.com/wbotelhos/stepy/issues

  • claudio

    October 11th, 2011

    Reply

    hi. In some case I need to hide or show an tab. I’ve tried with $(‘#idOfTheLabel’).hide();
    But nothing..

    can You help me please?

    • wbotelhos

      November 2nd, 2011

      Reply

      Hi Claudio,

      You always should let one tab visible.
      You can change between it using the function .step();

  • Amir

    September 29th, 2011

    Reply

    Hi,
    great too, thanks.
    I’m using it to slide form that have background image in every step. Can I use left to right slide of the steps such as the one in the following link – http://css-tricks.com/examples/FeaturedContentSlider/ .

    thanks,
    Amir

    • wbotelhos

      September 29th, 2011

      Reply

      Hi Amir,

      Stepy has no animation.
      You can leave all the fields visible and try to implement the slide.

  • Dan B

    September 28th, 2011

    Reply

    Ok –

    I sent you a separate email on your listed email, asking about some consulting work

    Thanks for your help!

  • Dan B

    September 28th, 2011

    Reply

    Although I am feeling dumber by the second, it didnt work either

    • wbotelhos

      September 28th, 2011

      Reply

      Well Dan,

      Then I’m sorry, just by text is hard to help you in this case, but try to use Firebug to check your element and then change the style.

  • Dan B

    September 28th, 2011

    Reply

    The problem seems to be that I want to apply a style to a . Here is the form:

    Name*

    CSS:
    .errorMessage {color: #F00;}

    And the ErrorPlacement
    errorPlacement: function(error, element) {
    error.appendTo( element.parent(“td”).next(“td”) );

    I am getting the error to show up in the last (empty) – but even creating a new style and setting it in the html is not working. So its showing up correctly, but not styling or even recognizing the style if I use the class attribute of the

    • wbotelhos

      September 28th, 2011

      Reply

      Hi Dan,

      Weird, but tries the worst way:

      element.addClass('my-error-class').parent("td").next("td")

  • Dan B

    September 28th, 2011

    Reply

    I apologize – my last post was not clear….
    I have change the error placement to:

    errorPlacement: function(error, element) {
    error.appendTo( element.parent(“td”).next(“td”) );},

    It works, but the message (“Required”) appears in black – I want it to be red like it was in the demo (just not placed under the form.)

    I tried modifying the css style “label.error” but I cant just the font color to change.

    Hope that is clearer

    • wbotelhos

      September 28th, 2011

      Reply

      Hi Dan,

      Inspect the text and make sure the element is a label to apply the style on label.error.
      Or change the element type to input, select, something like or just .error.
      If you already have a .error style, try the override with !important.

  • Dan B

    September 27th, 2011

    Reply

    Hi –

    I am trying to change the color of the error label (“Required”) and can not. Changing/adding to the class label.error does nothing.

    The color is currently black – I just want to change it to red

    Can you point me in the right direction please?

    Thanks!

    • wbotelhos

      September 28th, 2011

      Reply

      Hi Dan,

      Try label.error { color: #F00; }

  • Dan B

    September 20th, 2011

    Reply

    Hi –

    this is a fantastic tool!!

    Being new and not quite understanding everything jQuery, how would I call the validate function during a callback?

    I am fooling around with the transition callback example and would like to validate the “name” field..

    Thanks!

    • wbotelhos

      September 28th, 2011

      Reply

      Hi Dan,

      Just set the option validate to true.

  • Martin

    August 27th, 2011

    Reply

    This works:

      Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
      Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
    
      var stepySelectedTab;
    
      function BeginRequestHandler(sender, args) {
        stepySelectedTab = 1;
    
        if ($('#ReportElementWizard-title-2').hasClass('current-step')) { stepySelectedTab = 2; };
        if ($('#ReportElementWizard-title-3').hasClass('current-step')) { stepySelectedTab = 3; };
        if ($('#ReportElementWizard-title-3').hasClass('current-step')) { stepySelectedTab = 4; };
      }
    
      function EndRequestHandler(sender, args) {
        $.fn.stepy.step(stepySelectedTab, '#ReportElementWizard');
      }
    
    • wbotelhos

      November 2nd, 2011

      Reply

      Hi Martin,

      This is strange, because the title will have the current class-step only when the fieldset is displayed.
      Be sure to perform the public function within a function $(function() { }), and leave it for last, ensuring that all processing of your page is executed.

  • Martin

    August 26th, 2011

    Reply

    Hi! Thanks for a great plugin. It works wonderful except for this: The plugin is positioned in an Asp.Net UpdatePanel. If a control in say, Step 4 causes a postback the plugin returns to Step 1. As a workaround I thought I’d call something like $.fn.stepy.step(4, ‘#ReportElementWizard’); This does set the plugin back to Step 4 but also adds a style attribute “Display:none” to the enclosed fieldsets. Therefore only title and legend are still visible, the tab content has disappeared. Am I doing something wrong? Thanks!!

    • wbotelhos

      November 2nd, 2011

      Reply

      Hi Martin,

      Could you try the version 1.0.0?

      Thanks.

  • inii

    August 22nd, 2011

    Reply

    its awesome,
    i have a question.. could this error message, displayed to specific fields?

    • wbotelhos

      August 29th, 2011

      Reply

      Hi inii,

      It is the responsibility of jQuery Validate.
      Here you have several explanations: http://docs.jquery.com/Plugins/Validation

      As you see on example documentation of the Stepy, you can change the errorPlacement callback like:

      errorPlacement: function(error, element) {
          $('#place').append(error);
      }
      
  • Dana

    August 12th, 2011

    Reply

    I’m using jQuery Stepy – A Wizard Plugin but i’m unable to hide the fieldset title somebody help???

    • wbotelhos

      August 30th, 2011

      Reply

      Hi Dana,

      Use the following option:

      legend: false
  • wilson

    August 12th, 2011

    Reply

    Olá Washington!
    Parabéns pela excelente ferramenta.
    Estou testando e estou muito satisfeito.
    Só uma dúvida , como posso configurar para quando o clicar no botão Finish os dados sejam enviados para outra página .php

    Abraços e sucesso!!

    • wilson

      August 15th, 2011

      Reply

      Já consegui me virar.
      Obrigado!!

    • wbotelhos

      August 29th, 2011

      Reply

      Hi Wilson,

      It is the same as any other form configuration, regardless of the Stepy.
      Just use a submit button or put an onclick action on the button element.

  • csheets

    August 11th, 2011

    Reply

    I am trying to upgrade to stepy 0.5.1 and validate 1.8.1 and I have run into a validation problem for “optional” fields – fields that are not required but have additional validation such as maxlength. What seems to be happening is that it is always required even though the required: false rule is being applied. Any help would be appreciated. My validation rule is as follows:

    KEY: 	{required: false, maxlength: 5 }
    
    • wbotelhos

      August 11th, 2011

      Reply

      Hi csheets,

      Yes, unfortunately we have a problem.
      It was occurred by my mistake on this issue: https://github.com/wbotelhos/stepy/pull/2
      We must keep the variable isCurrentElementValid to compare if the return is undefined throwed be the jQuery Validate on your case.
      undefined && true must be true, but it returns false, then the validate fails when it should not.

      Can you open a issue for it, please?: https://github.com/wbotelhos/stepy/issues

  • Graham Peel

    July 26th, 2011

    Reply

    Hi there. I like this plugin a lot but it seems to tank when used in an ASP.NET webforms app (not MVC). The final step in my page has a Link Button to trigger a function on postback, and when it fires, all the form fields are reverted to blanks for some reason. Any ideas? (Not sure if you’ve ever had to mess with Web forms for .NET, if not, no biggie, I’ll just have to figure something else out)

    • wbotelhos

      July 29th, 2011

      Reply

      Hi Peel,

      The Stepy will not keep you value like cookie or something.
      Probably you doing a postback and a redirect in which there is no data that you just send to your controller.
      Try to keep it in the request with forward and apply the correctly names on inputs.

  • Paul

    July 23rd, 2011

    Reply

    Hi, I know this is probably completely thick of me, but i’m struggling to get my head around this..

    What i’d like to know is:
    How can I take your example of a custom form using Stepy, and add validation to it aswell?, only it should check validation first, then if it’s ok do a callback process ?
    I have tried mashing the two examples together to no avail – i’ll keep trying in the interim.

    Cheers for what (so far!) looks to be a BRILLIANT piece of work.
    Paul

  • Nathan

    July 20th, 2011

    Reply

    This is a nice control. I have had issues though, getting jQuery validation to work. I constantly get the error ‘element is undefined’ from jquery.validate.js line 808 (inside staticRules function()) in FireBug and the validation doesn’t run.

    Has anybody else seen and/or resolved this? My html code is :

    “Your code does not appear. Put it into the tag: ([)source language="html"(]) … ([)/source(])

    Then my javascript code:

    $(function () {
    
        $('#CreateArtist').stepy({ validate : true }); 
    
        $('#CreateArtist').validate({
            errorPlacement: function (error, element) {
                $('#CreateArtist div.stepy-error').append(error);
            }, rules: {
                "FirstName": "required",
                "LastName": "required"
            }, messages: {
                "FirstName": "FirstName field is required!",
                "LastName": "LastName field is required!"
            }
        });
    });
    

    If someone has seen this before, I’d appreciate a response!

    Thanks muchly

    • wbotelhos

      July 23rd, 2011

      Reply

      Hi Nathan,

      I did some tests using you script code and it worked fine with the following versions:
      jQuery 1.6.1rc1, Validate 1.8.1 and Stepy 0.5.1

      You HTML did not appear then a used the following field:

      <input type="text" name="FirstName" />
      

      * Try not to use ID and fields names with the first letter in uppercase, it’s not a good practice.

  • Jim

    July 20th, 2011

    Reply

    Hi wbotelhos,
    I hope you fine ..
    what is the function name under next, back and finish button ?
    because I need call it from another link ..
    how can I customize the finish action .. assume that I need go to another page ?

    Best Regards

    • wbotelhos

      July 20th, 2011

      Reply

      Hi Jim,

      There is no function next, back or finish.
      You can use the index value to choose the step you want like:

      $.fn.stepy.step(2, '#stepy');
      

      You can use selector jQuery to click the back, next or finish button too.

  • Raed

    July 20th, 2011

    Reply

    Hi Dear,

    How can I dedect asp elements inside validation code ?

    rules: {
    ‘rdlViews’: ‘required’
    },
    messages: {
    ‘rdlViews’: { required: ‘required field missed !’ }
    }
    });

    • wbotelhos

      July 20th, 2011

      Reply

      Hi Raed,

      Independently of language, the Validate detects the field by its name.
      If you want use asp values, you can select this value by JavaScript or in the case like JSP, using EL.

  • Jerry

    July 15th, 2011

    Reply

    I am using jquery stepy with ie browser. It is very cool, but I have one question. It often displays exception like this: the console is undefined.
    I google it and get that the console is for firefox, so I delete the code

    if (console && console.log) {
     console.log(f);
    }
     

    from jquery.stepy.min.js.

    now it doesn’t display that exception any more. However I am not sure if this is the best solution to this problem. I will really appreciate if you give me a hand.

  • Bruno Cezar Rocha

    June 29th, 2011

    Reply

    Olá,

    A noite inteira programando e terminei.

    Veja como ficou e se tem alguma critica/sugestão.

    codigo Python:
    https://bitbucket.org/rochacbruno/powerformwizard/src/ba92ee7c7627/modules/plugin_PowerFormWizard.py

    Live Demo:
    http://labs.blouweb.com/powerformwizard

    Abraço, e mais uma vez Obrigado!

    @rochacbruno

    • wbotelhos

      June 29th, 2011

      Reply

      Oi Bruno,

      Muito bom!
      Fico feliz de você ter se forkado o projeto e ter dado os créditos.
      Assim que possível irei contribuir com o que eu puder.
      Depois eu linko o PowerFormwizard no projeto do Stepy. (;

      Parabéns! (:

  • Bruno Cezar Rocha

    June 29th, 2011

    Reply

    Hi,

    I just created a plugin to integrate your libs with web2py Python Framework.

    The result is on labs.blouweb.com

    The first released is the web2py PowerFormWizard (which will be included in PowerPlugins)

    That is based on your Stepy! thank you!

    Your credits are properly on the source and license is MIT.

    Thanks.

  • Lucky

    June 22nd, 2011

    Reply

    Hi, I have a question..

    How can I make the field focused when the error found? Currently, it only focused on the first field…

    Thx

  • Andrea

    June 20th, 2011

    Reply

    Hi wbotelhos!

    Very good plugin for wizard :)

    When I insert in field form wrong value the validate engine show me the error message. It’s correct!

    Can I hide this messages without insert correct value?

    I use stepy in a form placed into a jQuery Dialog, I’d like that when user close the dialog without insert correct value, I can clean text and delete error messages.

    It could be a feature request :P

    Sorry for my English!
    Thank you in advance for any answer.

    Andrea

    • wbotelhos

      June 23rd, 2011

      Reply

      Hi Andrea,

      Stepy can clear “only” the div with the error text, because the field error (highlight) should be cleared by jQuery Validate. Just to the Stepy do not be intrusive.
      You can clear the div error using the jQuery selector:

      $('#stepy-id').children('.stepy-error').empty();
      
  • DevPHP

    June 9th, 2011

    Reply

    Hi,

    I’m using stepy and it is working great.
    However – although a bit stupid – when there’s only one fieldset (in my app a user can make this happen since fieldsets are generated dynamic) the submit-button is not shown.
    How can I show the submit-button manually?

    Thx in advance.

    James

  • Neha

    May 24th, 2011

    Reply

    Hi, I tries stepy and everything is great.
    The only thing that I am concerned is that if I have more than 10 steps in my wizard, it doesn’t work with steps greater than 10.

    How can I make it work? Please suggest.

    Thanks in advance,
    Neha

  • Tamil Vendhan

    May 10th, 2011

    Reply

    Hi, i am using your stepy.js Its working cool, but i want to hide the titles sometimes. How do i do that?

    • wbotelhos

      May 25th, 2011

      Reply

      Hi Tamil,

      You can use, with the last version, the ID of the title:

          $('#stepy-title-0').hide();
          //$('#' + ID_OF_THE_GRID + '-title-' + (INDEX - 1)).hide();
      
  • Brandon

    March 14th, 2011

    Reply

    I’m using your jQuery Plugin Stepy and so far it is great!
    I do have a question though – how could I trigger a function on the last “next” button?
    I need to use it to calculate fields in the final step instead of having the user click a special button like “Calculate” or “Submit”.

    Thanks!

    Brandon

    • wbotelhos

      March 14th, 2011

      Reply

      Hi Brandon,

      You can ask if the index is the last like:

      $('#form').stepy({
          onNext: function(index) {
              if (index == QTY_STEP) {
                  alert('My function here!');
              }
        }
      });
      
  • [...] be using jQuery for validation (hence the phone/email classes and required options) and the jQuery Stepy plugin to have the form subdivided into different [...]

Leave a Comment

* are Required fields



Email
Print
WP Socializer Aakash Web