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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:25:15+00:00 2026-06-06T08:25:15+00:00

This was an answer I got recently but the topic has died down and

  • 0

This was an answer I got recently but the topic has died down and I have a few more questions to ask about it:

“That’s quite a common request. Here is one way

  • Break your form in pages using divs with easy to manage ids and only the first one visible

.

<form action=".." ..>
<!-- the first page has style set to be visible -->
<div id="formpage_1" style="visibility: visible; display: block; .."> 
  <label for="..">..</label>
  <input type=".." ..>
  ..
  <!-- NEXT button -->
  <input type="button" value="next" onclick="pagechange(1,2);">
</div>
<!-- the 2nd and following pages have style set to be invisible -->
<div id="formpage_2"  style="visibility: hidden; display: none; ..">
  <label for="..">..</label>
  <input type=".." ..>
  ..
  <!-- PREVIOUS and NEXT buttons -->
  <input type="button" value="back" onclick="pagechange(2,1);">
  <input type="button" value="next" onclick="pagechange(2,3);">
</div>
...
<div id="formpage_10"  style="visibility: hidden; display: none; ..">
  <label for="..">..</label>
  <input type=".." ..>
  ..
  <!-- PREVIOUS and SUBMIT buttons -->
  <input type="button" value="back" onclick="pagechange(10,9);">
  <input type="submit" value="Submit">
</div>
  • Use a simple JS function to switch between the pages

.

function pagechange(frompage, topage) {
  var page=document.getElementById('formpage_'+frompage);
  if (!page) return false;
  page.style.visibility='hidden';
  page.style.display='none';

  page=document.getElementById('formpage_'+topage);
  if (!page) return false;
  page.style.display='block';
  page.style.visibility='visible';

  return true;
}

Edit

If you want to use a table layout, break the for into more tables (one for each page) and give the ids to the tables instead of the divs”

Now the above works, when using divs, but when I use tables it doesn’t work properly. The back, next buttons show all the time whether hidden or not and they always appear at the top. Any way to prevent this as I don’t want to re-style everything now that I am using divs as opposed to tables.

Also when I click next and I’m at the bottom of a form it will take me to the middle/bottom of the next. Is there a way to link it to the top each time someone clicks back/next?

  • 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-06T08:25:20+00:00Added an answer on June 6, 2026 at 8:25 am

    perhaps it helps you?

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
     <head>
      <title> New Document </title>
      <meta name="Generator" content="EditPlus">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <script>
    
    
        function pagechange(currentPage) {
         var divs=document.getElementsByTagName("div");
         for(var i=0;i<divs.length;i++){
           if(divs[i].id!=('formpage_'+(parseInt(currentPage)+1))){
              divs[i].style.display="none";
              divs[i].style.visibility='hidden';
           }else{
             divs[i].style.display="block";
             divs[i].style.visibility='visible';
           }
         }
       }
    
      </script>
     </head>
    
     <body>
      <form action=".." ..>
    <!-- the first page has style set to be visible -->
    <div id="formpage_1" style="visibility: visible; display: block; .."> 
      <label for="..">..</label>
      <input type=".." ..>
      ..
      <!-- NEXT button -->
      <input type="button" value="next" onclick="pagechange(1);">
    </div>
    
    <!-- the 2nd and following pages have style set to be invisible -->
    <div id="formpage_2"  style="visibility: hidden; display: none; ..">
      <label for="..">..</label>
      <input type=".." ..>
      ..
      <!-- PREVIOUS and NEXT buttons -->
      <input type="button" value="back" onclick="pagechange(0);">
      <input type="button" value="next" onclick="pagechange(2);">
    </div>
    ...
    <div id="formpage_3"  style="visibility: hidden; display: none; ..">
      <label for="..">..</label>
      <input type=".." ..>
      ..
      <!-- PREVIOUS and SUBMIT buttons -->
      <input type="button" value="back" onclick="pagechange(1);">
      <input type="submit" value="Submit">
    </div>
    
     </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been researching this for a while but got no convinced answer. From
I asked this question on the SCB forum but got no answer I'm trying
This is probably got a simple answer to it, but I am having problems
I have got this result with the answer given by bluefeet Equipt BSL AQ
This should be simple, but the answer is eluding me. If I've got a
I recently posted this question on the r-help mailing list but got no answers,
I recently asked this question https://softwareengineering.stackexchange.com/questions/129076/go-instead-of-c-c-with-cgo and got some very interesting input. However there's
I recently asked this question on here and got the answer. However I'm now
I recently learned about strides in the answer to this post , and was
i have already posted my issue in SO and got an answer but i

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.