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 8084909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:56:17+00:00 2026-06-05T17:56:17+00:00

I have a multi-step order form built in this manner: Step 1: Choose category

  • 0

I have a multi-step order form built in this manner:

Step 1: Choose category via radio button

The “Next” button is just an image that has an onclick function hides the current div with the radio buttons, and displays a new div with the next step in the process.

Step 2: Textarea, checkbox -> Dynamic price

Contains a textarea, a dynamic price, and four checkboxes. The price changes depending on the number of characters in the textarea and the choices in the checkboxes. JQuery script is used in order to do that. Again, the “Next” button is just an image that upon activating the onclick function hides the current div, and displays the div containing the next step in the form.

Step 3: Personal Data

And here is my problem. Here where the user inserts name, email and so on. The “Next” button is again just an image that upon activating the onclick function hides the current div and displays the div containing the next step. How do i make the form fields in this step required in order to allow the user to advance to the next step. The code i have for hiding and showing the divs is as follows:

<script type="text/javascript">
    function toggleDiv(id, flagit) {
        if (flagit == "1") {
            if (document.layers) document.layers[''+id+''].visibility = "show"
            else if (document.all) document.all[''+id+''].style.visibility = "visible"
            else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
        }
        else`if (flagit == "0") {
            if (document.layers) document.layers[''+id+''].visibility = "hide"
            else if (document.all) document.all[''+id+''].style.visibility = "hidden"
            else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"`
        }
    }
    //-->
</script>
  • 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-05T17:56:19+00:00Added an answer on June 5, 2026 at 5:56 pm

    That is a horrible (and wrong) piece of old code.

    here is an update that actually still handles Netscape4 (the layers part)

    You need to show me the rest of the script where you toggle. You need to add validation to
    THAT part, not the toggle.

    For example, using

    <form onsubmit="return validate(this)">
    

    and

    <input type="image" src="next.png" />
    

    you can do this (plain JavaScript, the show and hide in jQuery is shown elsewhere on the page):

    var currentStep=1;
    function toggleDiv(id,flagit) {
      if (document.getElementById) document.getElementById(id).style.visibility = (flagit)?"visible":"hidden";
      else if (document.all) document.all(id).style.visibility = (flagit)?"visible":"hidden";
      else if (document.layers) document.layers[id].visibility = (flagit)?"show":"hide";
    }
    function validate(theForm) {
      if (currentStep == 1)  {
        if (theForm.category.value....) {
          alert("Error in category");
          return false;
        }
        currentStep++;
        toggleDiv("part1",0);
        toggleDiv("part2",1);
        return false; // do not submit
      }
      if (currentStep == 2)  {
        if (theForm.price.value....) {
          alert("Error in price");
          return false
        }
        currentStep++;
        toggleDiv("part2",0);
        toggleDiv("part3",1);
        return false; // do not submit
      }
      if (currentStep == 3)  {
        if (theForm.name.value....) {
          alert("Error in name");
          return false
        }
        return true; // submit
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multi-step form in which i have to choose an image in
I have a multi-step form (a wizard) that I created using this railscast: http://railscasts.com/episodes/217-multistep-forms
I have a multi-step form where the form on Step3 submits to Step4.php. Step4
I have got a the following problem: I have got multi-step form where in
I'm doing a multi step form (form wizard) and I have splitted the form
I have a multi-step form and user can navigate to any page to modify
I have a multi-step form in an iOS application. To retain my data for
I have a multi-step file import process. I have a hidden form input in
I have a large multi-step form that will insert a record into a database.
How would one go about having a multi step type form with zend. This

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.