Module: Homeschool::FormBuildr

Defined in:
lib/form_buildr.rb

Overview

Provides an additional set of methods for working with forms.

See ActionView::Helpers::FormHelper in the Rails API docs
Author

Paul Nicholson ([email protected])

Co-Author

Austin Taylor

Copyright

Copyright © 2006 Paul Nicholson & Austin Taylor

License

Distributes under the same terms as Rails

Usage

<% form_for :person, @person, :url => { :action => "update" } do |f| %>
  <%= f.label_for :first_name %> <%= f.text_field :first_name %>
  <%= f.labeled_text_field :last_name %>
<% end %>

Methods

label_for(method, options={})

Returns a label opening and closing tag set tailored for accessing a specified form element(identified by Additional options on the label tag can be passed as a hash with options.

Additional Options
  • :label => The text used as the label(default is method.humanize)

Example (call, result):
label_for(:name)
  <label class="fieldLabel" for="person_name">Name:</label>

labeled_*(method, options={})

Returns a label opening and closing tag set and calls the referenced form builder method

Additional Options
  • See label_for and the form builder method docs

Example (call, result):
labeled_text_field(:name)
  <label class="fieldLabel" for="person_name">Name:</label>
  <input id="person_name" name="person[name]" size="30" type="text" />

Defined Under Namespace

Modules: InstanceMethods