Multi page forms
Permalink
Anyone know how I can make a multi page form? Rather than having all my questions in the form on one page, I want to be able to have the questions on different pages. I want the the user to answer a question, then click next until the final question where they would be given the submit button.
You are pretty much creating a single page for each step. You can do validation in that single pages controller and then set a cookie with the data and pass them to the next single page and repeat until the last one where you validate all the data again and store the info.
I you need to change which step they go to based on the question then I create a "router" single page that takes in the result of that single page and decides where to go next and sends them there via redirects.
I you need to change which step they go to based on the question then I create a "router" single page that takes in the result of that single page and decides where to go next and sends them there via redirects.
There are some very sexy jQuery form wizard plugins that break a form up into sections and style it as a form through a number of steps. Still only one submit at the end.
You would need to be comfortable doing a bit of javascript/jQuery to apply one to your form.
Googling for 'jquery form wizard' gives plenty of possibilities.
You would need to be comfortable doing a bit of javascript/jQuery to apply one to your form.
Googling for 'jquery form wizard' gives plenty of possibilities.
Thank you both for your fast responses. Quick question though, does either solution let you use the basic form block that comes with C5? The customer, whose site I am building, will need to update the form often.
If you were going to do it with a jQuery plugin and some javascript, you could create a page type for the forms and place the script in the header for that page type.
How it interacts with changes to forms depends on the jQuery plugin you choose and how sophisticated you want to get writing your own script to apply it to the form.
If I were setting this up, I would decide on a few key fields or labels that the script would look for in the form to separate it into stages for the wizard plugin. By having a naming convention for these keys, the script would then adapt to changes in the form as long as your customer stuck to the convention for the naming the key field at the top of each stage of the wizard..
How it interacts with changes to forms depends on the jQuery plugin you choose and how sophisticated you want to get writing your own script to apply it to the form.
If I were setting this up, I would decide on a few key fields or labels that the script would look for in the form to separate it into stages for the wizard plugin. By having a naming convention for these keys, the script would then adapt to changes in the form as long as your customer stuck to the convention for the naming the key field at the top of each stage of the wizard..
Have you found a solution to this? I'm interested in doing the same thing and I have no idea how I would go about it.
Rachel