You are here: Browse Railsplugins Wizard Form For
This plugin provides a multi-page wizard on a single page using hidden DIV elements. The user will see only one page at a time, but the all pages will be submitted at the end of the process to a standard ruby on rails controller using an extended form_for.
This is useful in situations where you have too many parameters in a single model to fit on one page.
The plugin also supports ajax validation of each page. In this mode, the wizard will not move to the next page if there is an error associated with a field on that page.
wizard_form_for extra options: :ajax_verify_url => {} —standard url_for input to invoke when verifying a page ALL other syntax and options are same as form_for
command that can be run inside of a “page” block: text_field, checkbox, etc —all standard form_for tags next_page_button(name = “Continue”, html_options = {}) next_page_link(name = “Continue”, html_options = {}) previous_page_button(name = “Continue”, html_options = {}) previous_page_link(name = “Continue”, html_options = {})
Simple usage:
<% wizard_form_for :user, @user, :url => users_path, :html => {:method => :create} do |f| %> <% f.page :one do |p| %> <%= p.text_field :name %> <%= p.text_field :email %> <%= p.next_page_button “Next Page” %> <% end %> <% f.page :two do |p| %>ra <%= p.text_field :address %> <%= p.text_field :city %> <%= p.text_field :state %> <%= p.text_field :zip %> <%= p.submit_button “Finish” %> <% end %> <% end %>
Usage with ajax verification:
<% wizard_form_for :user, @user, :url => users_path, :html => {:method => :create}, :ajax_verify_url => verify_ajax_users_path do |f| %> <% f.page :one do |p| %> ... <% end %> <% f.page :two do |p| %> ... <% end %> <% end %>
class UsersController < ApplicationController::Base def verify_ajax @user = User.new(params[:user]) render_wizard_ajax_errors(@user) end end
Copyright© 2007 ELC Technologies, released under the MIT license
NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly