Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Since they depend on information on one form, the "pages" should really be the same form. You use the jQuery/JavaScript to show/hide the "current page". This will allow you to submit all the data in one go.</p> <ol> <li>Wrap all the input elements in one html form tag</li> <li>For each form "segment" you will need to use your js to hide/show the wrapping HTML container. The default being "page 1" of the form and the rest hidden.</li> <li>Change your submit button to just a button and have a on click event on it. When the user clicks the button the input is validated and then the jQuery unhides "page 2".</li> <li>On your last "page" have a normal submit button and then all the form data is posted in one.</li> </ol> <p>For example, the html might look like this:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function{ $(".next-page").click(function(){ $(".box-wrapper").hide(); $("#page-" + $(this).data("page")).show(); }); }); &lt;/script&gt; &lt;div class="registration"&gt; &lt;form name="regform" action="" method="post"&gt; &lt;!-- Page 1 --&gt; &lt;div class="box-wrapper" id="page-1"&gt; &lt;div class="box"&gt; &lt;!-- form inputs go here --&gt; &lt;input type="button" name="next-page" class="next-page" value="Continue" data-page="2"/&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Page 2 --&gt; &lt;div class="box-wrapper" id="page-2" style="display: none;"&gt; &lt;div class="box"&gt; &lt;!-- form inputs go here --&gt; &lt;input type="button" name="next-page" class="next-page" value="Continue" data-page="3"/&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Page 3 --&gt; &lt;div class="box-wrapper" id="page-3" style="display: none;"&gt; &lt;div class="box"&gt; &lt;!-- form inputs go here --&gt; &lt;input type="submit" name="submit" class="submit" value="Complete Registration"/&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload