Plugins - Smart-Form 1.0

StarAdd to favorites

The last form plugin you may ever need

Generates form fields for a model - including it’s content columns, and all association reflections.

These form fields are encapsulated in an HTML definition list, and a style-sheet for table like layout is supplied.


Author:Michael Behan aka "Jabberwock" (jabberwock /AT tenebrous /DOT com)
Copyright:Copyright© 2007 Jabbewock
License:BSD
Request:Please feel free to e-mail me with feedback!

#

Generators:

You can generate a sample style-sheet with:

ruby ./script/generate SmartFormStyle

#

Note:

  +smart_form_for+ generates only the +form+ fields and not the starting/ending +form+ tags.

#

Usage:

  smart_form_for(symbol, options)

#

Examples:

  <% form_for "/people", :method => :post do %>
    <%= smart_form_for :person %>
  <% end %>

#

Other Examples:

  <%= smart_form_for :person, :exclude => 'created_at' %>
  <%= smart_form_for :person, :exclude => ['created_at', 'updated_at'], :class => 'my_list', :style => 'border:1px solid white;', :id => 'my_list' %>

#

Required

  • symbol — A symbol of a model instance variable for which the form fields will be generated.

Options

  • :object — Takes an instance variable (ie; used to load form defaults for editing)
  • :order — Display order; an array of column or reflectin names.
  • :habtm_select_values— A hash in which each key is a habtm reflection name and the value is the foreign column to use for the select/multiple option values. By default, the first column of type text or varchar is used.
  • :exclude — A String, or an Array of column names (or associatin reflection(s)) to exclude from the form.
  • :include — A String, or an Array of column names which would not otherwise be included in the model’s content_columns. For example, an ‘orders’ table might contain a ‘transaction_id’ column which refers to an Authorize.NET transaction ID, and not a foreign key to a ‘transactions’ table. Because this column ends with "_id", it will not be in the models content columns. Use this option to display form fields for these types of columns.
  • :class — The class attribute for the DL element (defaults to "smart_form").
  • :text_field — HTML options for text input fields.
  • :number_text_field — HTML options for text input fields that deal with numbers (ie: decimal, float, integer)
  • :text_area — HTML options for textarea elements
  • :select — Options for select (default: :include_blank => true). Also contains a nested :html hash of HTML options to pass.
  • :date_select — HTML options for date_select
  • :datetime_select — HTML options for datetime_select
  • :time_select — HTML options for time_select
  • :mselect — HTML options for +select multiple="multiple"+ boxes
  • :mselect_footnote — A footnote which appears below select/multiples (default: "(crtl+click to select multiple)")
  • :left_width — The width of the left column in pixels. If specified, this setting will override the style-sheet
  • :right_width — The width of the right column in pixels. If specified, this setting will override the style-sheet

Jabberwock

svn://rails.bleedingtrends.com/smart_form/trunk

BSD

  • Currently 4.9/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

View Extensions

Tags

Comments

Add a comment
m 3 Apr 2008

svn is not working, the site bleedingtrends.com is actually parked!

OA 27 Feb 2008

Repository still unavailable.

Henrique 8 Jan 2008

Can't get from Repository

Henrique 2 Dec 2007

Demo not working, I can't see how the form looks like.

Jabberwock 9 May 2007

They're based on the column or reflection names.

Torso 9 May 2007

Where are the labels coming from?

Jabbberwock 30 Apr 2007

By default, the display order is as it appears in the database (ie DESCRIBE TABLE or \d table. I have added an :order option which takes an array of column/reflections for display order. Please svn up!

jamieorc 28 Apr 2007

How is order of items in the form determined?

Jabberwock 27 Apr 2007

As promised, here is a simple demo:

http://admin.beta.ddna.org/smartformdemo

Jabberwock 27 Apr 2007

This appears to be an issue with your postgres gem installation. SmartForm extends ActiveRecord and doesn't actually reference the database adapter directly. Have you tried the ruby-pr gem?

george 27 Apr 2007

Hey looks like it does not work with postgres database. generates this error: "126: The specified module could not be found. - c:/ruby/lib/ruby/gems/1.8/gems/ruby-postgres-0.7.1.2006.04.06-mswin32/./postgres.so" despite having the latest build for that gem. Otherwise it worked fine with mysql database.

Ole Begemann 26 Apr 2007

I second the request for a live demo or screenshots. Would be most helpful.

Jabberwock 26 Apr 2007

I will have this up soon :) Thanks!

carlos k 25 Apr 2007

Please post a link with examples of how the smart forms look.

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?