aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/form_helpers.textile
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-02-06 02:25:55 +0000
committerPratik Naik <pratiknaik@gmail.com>2009-02-06 02:25:55 +0000
commitb9ba2fe55059a6d9f141d1d502e16bdfd46f26cb (patch)
tree491c3ce7d406a723e5c06e3bccf4559a0de86199 /railties/guides/source/form_helpers.textile
parent97612394672203eefd04e3b1947273a3ab4ec930 (diff)
parent96d610553e5fdaabc923835ab1f194070ddb4477 (diff)
downloadrails-b9ba2fe55059a6d9f141d1d502e16bdfd46f26cb.tar.gz
rails-b9ba2fe55059a6d9f141d1d502e16bdfd46f26cb.tar.bz2
rails-b9ba2fe55059a6d9f141d1d502e16bdfd46f26cb.zip
Merge commit 'mainstream/master'
Conflicts: railties/guides/files/javascripts/code_highlighter.js railties/guides/files/javascripts/guides.js railties/guides/files/javascripts/highlighters.js railties/guides/files/stylesheets/main.css railties/guides/files/stylesheets/print.css railties/guides/files/stylesheets/reset.css railties/guides/files/stylesheets/style.css railties/guides/files/stylesheets/syntax.css railties/guides/rails_guides/indexer.rb railties/guides/source/2_2_release_notes.textile railties/guides/source/2_3_release_notes.textile railties/guides/source/action_controller_overview.textile railties/guides/source/action_mailer_basics.textile railties/guides/source/active_record_basics.textile railties/guides/source/activerecord_validations_callbacks.textile railties/guides/source/association_basics.textile railties/guides/source/caching_with_rails.textile railties/guides/source/command_line.textile railties/guides/source/debugging_rails_applications.textile railties/guides/source/form_helpers.textile railties/guides/source/getting_started.textile railties/guides/source/i18n.textile railties/guides/source/layout.html.erb railties/guides/source/layouts_and_rendering.textile railties/guides/source/migrations.textile railties/guides/source/performance_testing.textile railties/guides/source/plugins.textile railties/guides/source/rails_on_rack.textile railties/guides/source/routing.textile railties/guides/source/security.textile railties/guides/source/testing.textile
Diffstat (limited to 'railties/guides/source/form_helpers.textile')
-rw-r--r--railties/guides/source/form_helpers.textile16
1 files changed, 8 insertions, 8 deletions
diff --git a/railties/guides/source/form_helpers.textile b/railties/guides/source/form_helpers.textile
index 8d29816e54..4e61bdcd26 100644
--- a/railties/guides/source/form_helpers.textile
+++ b/railties/guides/source/form_helpers.textile
@@ -273,7 +273,7 @@ which produces the following output:
<html>
<form action="/people/create" class="new_person" id="new_person" method="post">
- <input id="person_name" name="person[name]" size="30" type="text" />
+ <input id="person_name" name="person[name]" size="30" type="text" />
<input id="contact_detail_phone_number" name="contact_detail[phone_number]" size="30" type="text" />
</form>
</html>
@@ -553,7 +553,7 @@ h3. Uploading Files
A common task is uploading some sort of file, whether it's a picture of a person or a CSV file containing data to process. The most important thing to remember with file uploads is that the form's encoding *MUST* be set to "multipart/form-data". If you forget to do this the file will not be uploaded. This can be done by passing +:multi_part => true+ as an HTML option. This means that in the case of +form_tag+ it must be passed in the second options hash and in the case of +form_for+ inside the +:html+ hash.
-The following two forms both upload a file.
+The following two forms both upload a file.
<erb>
<% form_tag({:action => :upload}, :multipart => true) do %>
@@ -590,7 +590,7 @@ Unlike other forms making an asynchronous file upload form is not as simple as r
h3. Customising Form Builders
-As mentioned previously the object yielded by +form_for+ and +fields_for+ is an instance of FormBuilder (or a subclass thereof). Form builders encapsulate the notion of displaying form elements for a single object. While you can of course write helpers for your forms in the usual way you can also subclass FormBuilder and add the helpers there. For example
+As mentioned previously the object yielded by +form_for+ and +fields_for+ is an instance of FormBuilder (or a subclass thereof). Form builders encapsulate the notion of displaying form elements for a single object. While you can of course write helpers for your forms in the usual way you can also subclass FormBuilder and add the helpers there. For example
<erb>
<% form_for @person do |f| %>
@@ -598,7 +598,7 @@ As mentioned previously the object yielded by +form_for+ and +fields_for+ is an
<% end %>
</erb>
-can be replaced with
+can be replaced with
<erb>
<% form_for @person, :builder => LabellingFormBuilder do |f| %>
@@ -698,9 +698,9 @@ You might want to render a form with a set of edit fields for each of a person's
<erb>
<% form_for @person do |person_form| %>
<%= person_form.text_field :name %>
- <% for address in @person.addresses %>
+ <% for address in @person.addresses %>
<% person_form.fields_for address, :index => address do |address_form|%>
- <%= address_form.text_field :city %>
+ <%= address_form.text_field :city %>
<% end %>
<% end %>
<% end %>
@@ -711,8 +711,8 @@ Assuming the person had two addresses, with ids 23 and 45 this would create outp
<html>
<form action="/people/1" class="edit_person" id="edit_person_1" method="post">
<input id="person_name" name="person[name]" size="30" type="text" />
- <input id="person_address_23_city" name="person[address][23][city]" size="30" type="text" />
- <input id="person_address_45_city" name="person[address][45][city]" size="30" type="text" />
+ <input id="person_address_23_city" name="person[address][23][city]" size="30" type="text" />
+ <input id="person_address_45_city" name="person[address][45][city]" size="30" type="text" />
</form>
</html>