ChronoEngine Forums
Welcome, Guest
Please Login or Register.    Lost Password?
Multi-page Forms (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Multi-page Forms
#6940
jxl (User)
Fresh Boarder
Posts: 14
graphgraph
User Offline Click here to see the profile of this user
Multi-page Forms 3 Months, 1 Week ago Karma: 0  
I wanted a multi-page form with a button at the end of each page to go to the next page.
Credit where it's due, I got this javascript from http://phpformgen.sourceforge.net/ and modified it slightly for my purposes.

So here is what worked for me.
In the Form Code HTML box add your form like this:
Code:

<!-- begin page one --> <div id="mainForm_1"> <!-- FORM FIELDS FOR PAGE ONE HERE --> <!-- next page button --> <input type=button onclick=" collapseElem('mainForm_1'); expandElem('mainForm_2');" class="mainForm" value="Next Page" /> </div> <!-- begin page two --> <div id="mainForm_2"> <!-- PAGE TWO HERE --> <!-- next page button --> <input type=button onclick=" collapseElem('mainForm_3'); expandElem('mainForm_3');" class="mainForm" value="Next Page" /> <!-- previous page button --> <input type=button onclick="collapseElem('mainForm_2'); expandElem('mainForm_1');" value="Go Back"/> </div> <!-- begin page three --> <div id="mainForm_3"> <!-- PAGE THREE HERE --> <!-- previous page button --> <input type=button onclick="collapseElem('mainForm_3'); expandElem('mainForm_2');" value="Go Back"/> </div>
More pages can be added by creating a div for each additional page. Each additional div should have it's own id of mainForm_4, mainForm_5, mainForm_6, etc. Don't forget to add "Next Page" and "Previous Page" buttons to each new div, changing the element that colapsed and expanded as necessary. Note that the first page only has a next page button and the last page only has a previous page button. In the Form Code Javascript box add this:
Code:

// collapse individual elements function collapseElem(obj) { var el = document.getElementById(obj); el.style.display = 'none'; } // expand next element function expandElem(obj) { var el = document.getElementById(obj); el.style.display = ''; } // collapse all elements, except the first one function collapseAll() { // change the following line to reflect the number of pages var numFormPages = 3; for(i=2; i <= numFormPages; i++) { currPageId = ('mainForm_' + i); collapseElem(currPageId); } } // run the collapseAll function on page load window.onload = collapseAll;
In the Javascript above, you will need to make sure that the variable for the number of form pages matches the actual number of pages that you have. var numFormPages = 3; Means that there are three pages to the form. NOTE to simplify this you could eliminate the collapseAll() function from the javaScript by setting the css for the all the mainForm divs (except the first one) to display: none; However, by using javaScript to set the divs to hide visitors will be able to see the entire form even if they have javaScript disabled in their browser. Its just that the Next and Previous Page buttons wont do anything. Post edited by: jxl, at: 2008/03/30 00:38 to reflect all changes made after the following discussion with our hero Max. Thanks Max!<br><br>Post edited by: jxl, at: 2008/03/31 20:03
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
      Topics Author Date
    thread link
Multi-page Forms
jxl 2008/03/25 18:45
    thread link
thread linkthread link Re:Multi-page Forms
jxl 2008/03/26 03:52
    thread link
thread linkthread linkthread link Re:Multi-page Forms
admin 2008/03/27 01:40
    thread link
thread linkthread linkthread linkthread link Re:Multi-page Forms
jxl 2008/03/29 03:13
    thread link
thread linkthread linkthread linkthread linkthread link Re:Multi-page Forms
admin 2008/03/30 12:49
    thread link
thread linkthread linkthread linkthread linkthread linkthread link Re:Multi-page Forms
jxl 2008/03/30 22:38
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread link Re:Multi-page Forms
admin 2008/03/31 18:40
    thread link
thread linkthread link Re:Multi-page Forms
jxl 2008/03/31 20:08
    thread link
thread linkthread linkthread link Re:Multi-page Forms
Raymon 2008/04/03 11:21
    thread link
thread linkthread linkthread linkthread link Re:Multi-page Forms
admin 2008/04/04 15:07
    thread link
thread linkthread linkthread linkthread linkthread link Re:Multi-page Forms (session timeout and autosave)
wgalindo 2008/06/13 10:26
    thread link
thread linkthread linkthread linkthread linkthread linkthread link Re:Multi-page Forms (session timeout and autosave)
GreyHead 2008/06/13 10:32
    emo
thread linkthread linkthread linkthread linkthread linkthread linkthread link Re:Multi-page Forms (session timeout and autosave)
wgalindo 2008/06/13 10:55
    thread link
thread linkthread linkthread linkthread linkthread linkthread linkthread linkthread link Re:Multi-page Forms (session timeout and autosave)
GreyHead 2008/06/14 01:00
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop


equalheight If you have any questions you can post to our forums and we will be glad to help ASAP

Members Login






Lost Password?
No account yet? Register

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for
goods and services provided by ChronoEngine.com

ChronoForms License

equalheightTo be able to continue working at this component we decided to get a small profit out of it but at the same time don't force everybody to pay in order to use this great component.

 

 From version 1.5 and up a link at the bottom of everyform created will be placed, saying "joomla professional work", the link will be to us here htttp://www.chronoengine.com, its illegal to remove this link from the source code unless you have a license,

so the license is very simply for the same ChronoForms component without a link, thats all!

This License is for 5 different websites ONLY. 

 

 However, in order to allow everybody to still use the component and even get out of this, the link is inside a div with class : chronoform , use this to hide the link by using different colors or whatever if you really can't pay, but of course the link is still exists at your page source.

 

The license is ONLY 25$ can be bought here :

 

Thank you!

 

ChronoEngine.com Team 

Joomla Templates and Joomla Tutorials