This is a fairly general request. Here is one way:
- Divide the form on the pages using a
div with an easy-to-manage id and only the first one is visible
.
<form action=".." ..> <div id="formpage_1" style="visibility: visible; display: block; .."> <label for="..">..</label> <input type=".." ..> .. <input type="button" value="next" onclick="pagechange(1,2);"> </div> <div id="formpage_2" style="visibility: hidden; display: none; .."> <label for="..">..</label> <input type=".." ..> .. <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=".." ..> .. <input type="button" value="back" onclick="pagechange(10,9);"> <input type="submit" value="Submit"> </div>
- Use the simple JS function to switch between 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 the table layout, split the for into several tables (one for each page) and assign id tables instead of div s
source share