Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7762875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:31:17+00:00 2026-06-01T14:31:17+00:00

I am using Wizard-step for my form in a view, My project is on

  • 0

I am using Wizard-step for my form in a view, My project is on MVC3.

I have a form that is made on 3 steps which means I have three tags for each step in my form
and two buttons that are following:

<p><input type="button" id="next-step" class="next-step-client-val" name="next-step" value="Next" /></p><     
<p><input type="button" value="Back id="back-step" name="back-step"></p>

In my first step I have only a bunch of TextBoxes, DropDownlists and TextAreas, second step have alot of client-side functionality, one example is that user can move rows from a table to another one etc.. And I have a Jquery validation that is following:

                var customTbl = $('#CustomPickedTable');
                var has1 = customTbl.find('td[data-row="1"]').is('*');
                var has2 = customTbl.find('td[data-row="2"]').is('*');
                var has3 = customTbl.find('td[data-row="3"]').is('*');
                var has4 = customTbl.find('td[data-row="4"]').is('*');
                if ((has1 === true) && (has2 === true) && (has3 === true) && (has4 === true)) {
                    jAlerts("Saved", "Info");
                } else {
                    jAlert('You have to move atleast one row from each table', "Varning"); ;
                     return false
                }

On the 3th step its just a review on what was created and my next-step button submits the form, when a user clicks on it.

What I want to be able to do is that when a user is on the 2th step and clicks on next-step button the jquery validation above should run. With my Wizard-step code I cant do that beacuse it uses next-step button selector for everything. Is there any solutions for this?

I have tried to put my Jquery validation code inside

$("#next-step").click(function () {

}

But then my jquery validation code run everytime a user clicks on next button, beacuse my tables are shown in the form but hidden, the validation triggers on first step when a user click on next. So that solution didnt work.

This is my Wizard-step Jquery Code and right now I have my Jquery validation in the bottom which means that when im on 3th step and click on next-step button it will validate and then post. But I dont want it to be like that. I want the validation to happen on the 2th step.

Here is the code:

$(function () {

            $(".wizard-step:first").fadeIn(); // show first step
            // attach backStep button handler
            // hide on first step
            $("#back-step").hide().click(function () {
                var $step = $(".wizard-step:visible"); // get current step
                if ($step.prev().hasClass("wizard-step")) { // is there any previous step?
                    $step.hide().prev().fadeIn(4500);  // show it and hide current step

                    // disable backstep button?
                    if (!$step.prev().prev().hasClass("wizard-step")) {
                        $("#back-step").hide();
                    }
                }
            });


            // attach nextStep button handler       
            $("#next-step").click(function () {

                var $step = $(".wizard-step:visible"); // get current step
                var validator = $("form").validate(); // obtain validator
                var anyError = false;
                $step.find("select").each(function () {
                    if (!this.disabled && !validator.element(this)) { // validate every input element inside this step
                        anyError = true;
                    }

                });
                $step.find("input").each(function () {
                    if (!validator.element(this)) { // validate every input element inside this step
                        anyError = true;
                    }

                });

                $("#next-step").click(function () {
                    if (!validator.element(this)) { // validate every input element inside this step
                        anyError = true;
                    }


                });

                if (anyError)
                    return false; // exit if any error found

                if ($step.next().hasClass("confirm")) { // is it confirmation?
                    // show confirmation asynchronously
                    $.post("/wizard/confirm", $("form").serialize(), function (r) {
                        // inject response in confirmation step
                        $(".wizard-step.confirm").html(r);
                    });

                }

                if ($step.next().hasClass("wizard-step")) { // is there any next step?
                    $step.hide().next().fadeIn(4500);  // show it and hide current step
                    $("#back-step").show();   // recall to show backStep button
                }

                else { // this is last step, submit form
                    var selectedQuestions = $("#SelectedQuestions");
                    var selectedCustomQuestions = $("#SelectedCustomQuestions");
                    var currentIds = new Array();
                    var currentText = new Array();

                    $("#CustomPickedTable td[data-question-id]").each(function () {
                        var clickedId = $(this).attr("data-question-id");
                        currentIds.push(clickedId);
                    });
                    $('#CustomPickedTable td[data-attr-id]').each(function () {
                        var ClickedText = $(this).html();
                        currentText.push(ClickedText);
                    });

                    selectedCustomQuestions.val(currentText.join("|"));
                    selectedQuestions.val(currentIds.join(","));

                    var customTbl = $('#CustomPickedTable');
                    var has1 = customTbl.find('td[data-row="1"]').is('*');
                    var has2 = customTbl.find('td[data-row="2"]').is('*');
                    var has3 = customTbl.find('td[data-row="3"]').is('*');
                    var has4 = customTbl.find('td[data-row="4"]').is('*');
                    if ((has1 === true) && (has2 === true) && (has3 === true) && (has4 === true)) {
                        jAlerts("saved", "Info");
                    } else {
                        jAlert('You have to move atleast one row from each table', "Varning"); ;
                    }
                    return false;

                }

            });

My html code looks something like this:

<div class="wizard-step>

   //step 1 content

</div>
<div class="wizard-step>

//step 2 content

</div>
<div class="wizard-step>

//step 3 content

</div>
<p><input type="button" id="next-step" class="next-step-client-val" name="next-step" value="Next" /></p><     
<p><input type="button" value="Back id="back-step" name="back-step"></p>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:31:18+00:00Added an answer on June 1, 2026 at 2:31 pm

    I think it would be better if you detect at which wizard step you are using jquery .index() function. This way you can do the validation in your next step click handler only if you are on second step moving on to the third step. The code would look something like this :

     $("#next-step").click(function () {
    
                var $step = $(".wizard-step:visible"); // get current step
                var stepIndex = $(".wizard-step").index($step); //index returns 0 based index so second step would be 1.
    
                var validator = $("form").validate(); // obtain validator
                var anyError = false;
                $step.find("select").each(function () {
                    if (!this.disabled && !validator.element(this)) { // validate every input element inside this step
                        anyError = true;
                    }
    
                });
                $step.find("input").each(function () {
                    if (!validator.element(this)) { // validate every input element inside this step
                        anyError = true;
                    }
    
                });
    
    
                if (anyError)
                    return false; // exit if any error found
                if(stepIndex == 1) //if you are on second step then validate your table 
                {
                   var customTbl = $('#CustomPickedTable');
                   var has1 = customTbl.find('td[data-row="1"]').is('*');
                   var has2 = customTbl.find('td[data-row="2"]').is('*');
                   var has3 = customTbl.find('td[data-row="3"]').is('*');
                   var has4 = customTbl.find('td[data-row="4"]').is('*');
                   if ((has1 === true) && (has2 === true) && (has3 === true) && (has4 === true)) {
                      jAlerts("Saved", "Info");
                   } else {
                      jAlert('You have to move atleast one row from each table', "Varning"); ;
                      return false
                   }
                }
    
                else if ($step.next().hasClass("confirm")) { // is it confirmation?
                    // show confirmation asynchronously
                    $.post("/wizard/confirm", $("form").serialize(), function (r) {
                        // inject response in confirmation step
                        $(".wizard-step.confirm").html(r);
                    });
    
                }
    
                if ($step.next().hasClass("wizard-step")) { // is there any next step?
                    $step.hide().next().fadeIn(4500);  // show it and hide current step
                    $("#back-step").show();   // recall to show backStep button
                }
    
                else { // this is last step, submit form
                    var selectedQuestions = $("#SelectedQuestions");
                    var selectedCustomQuestions = $("#SelectedCustomQuestions");
                    var currentIds = new Array();
                    var currentText = new Array();
    
                    $("#CustomPickedTable td[data-question-id]").each(function () {
                        var clickedId = $(this).attr("data-question-id");
                        currentIds.push(clickedId);
                    });
                    $('#CustomPickedTable td[data-attr-id]').each(function () {
                        var ClickedText = $(this).html();
                        currentText.push(ClickedText);
                    });
                }
    
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Wizard-Step in my MVC3 project, it is two steps right now
I am building wizard step demo application with MVC3 and using razor view engine
I have a Java applet consisting of a wizard-like form with three steps. At
I have an ASP.NET form with multiple steps (using the Wizard control). When advancing
I'm using the jQuery form wizard plugin. I have 20 questions that each have
I have a form wizard. On step one I need to display a warning
I want to have a form which has a simple 2 step process: (If
I have an asp:wizard control that contains five WizardSteps. All of these steps have
I have connected with the database successfully by using wizard in server explorer. but
We have a Visual Studio Wizard written using the DTE environment to automatically generate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.