Ruby on Rails
HowToBuildMultiStageForms

First, the bad news

Rails does not have built-in support for generating multi-stage forms, or wizards as they are sometimes known.

Second, the good news

There is nothing about the Rails framework to prevent you from using your own system for building multi-stage forms. In fact a number of Rails components would likely be of great use in such an effort.

So what now?

A few enterprising coders have shared their approaches to building multiple-stage forms in Rails.

Toolmantim

Multi-step forms http://www.bigbold.com/snippets/posts/show/277

Controller based — the Sequenced module

Jeffrey Moss (zardinuk on IRC) wrote to the mailing list:

I made this mixin to help with my application, we have an order form where the user can order a number of services, such as local, long distance, wireless service and all that. No matter what they order, there are things we need to get like customer information, billing information, other things that are common amongst a few like credit card information, shipping address, and then pages that are unique to one product/service, like choosing a wireless calling plan. This utility allows me to string a sequence of actions together and eliminate the “linked list” approach where links are embedded all over the place. Inserting a new action or a different behavior in the middle of your app is as simple as it can be. Some basic conditional code is also allowed to test whether or not the action should be displayed or skipped over.

This is halfway in between the current rails behavior and frameworks like seaside, or the continuation support in wee. Although it is not as powerful, I think this method offers a number of advantages like the ability to incorporate your application flow into a class hierarchy. I figured some other people might be interested in using something like this, some in the IRC channel have expressed interest in it. I’ve been using it for a few weeks and it appears to work fine.

Sequenced Module code is available at http://www.opendbms.com/sequenced.rb (alternate: http://de.pastebin.ca/23559)

h2. See also