aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_tag_helper.rb
diff options
context:
space:
mode:
authorAndrew Kaspick <andrew@redlinesoftware.com>2008-09-25 21:44:34 -0500
committerMichael Koziarski <michael@koziarski.com>2008-09-29 17:47:29 +0200
commit8c105ee0c888a63cdbf593f0bfe688065b3e09e2 (patch)
tree77cd68de0493f04fc746f1737c7b10bd79a26c3f /actionpack/lib/action_view/helpers/form_tag_helper.rb
parent28bf2fa03886e3ea7d873375239395b91b8e530e (diff)
downloadrails-8c105ee0c888a63cdbf593f0bfe688065b3e09e2.tar.gz
rails-8c105ee0c888a63cdbf593f0bfe688065b3e09e2.tar.bz2
rails-8c105ee0c888a63cdbf593f0bfe688065b3e09e2.zip
Add options to field_set_tag
Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1116 state:committed]
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_tag_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb
index 294c22521e..208bf91dd4 100644
--- a/actionpack/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -403,6 +403,7 @@ module ActionView
# Creates a field set for grouping HTML form elements.
#
# <tt>legend</tt> will become the fieldset's title (optional as per W3C).
+ # <tt>options</tt> accept the same values as tag.
#
# === Examples
# <% field_set_tag do %>
@@ -414,9 +415,14 @@ module ActionView
# <p><%= text_field_tag 'name' %></p>
# <% end %>
# # => <fieldset><legend>Your details</legend><p><input id="name" name="name" type="text" /></p></fieldset>
- def field_set_tag(legend = nil, &block)
+ #
+ # <% field_set_tag nil, :class => 'format' do %>
+ # <p><%= text_field_tag 'name' %></p>
+ # <% end %>
+ # # => <fieldset class="format"><p><input id="name" name="name" type="text" /></p></fieldset>
+ def field_set_tag(legend = nil, options = nil, &block)
content = capture(&block)
- concat(tag(:fieldset, {}, true))
+ concat(tag(:fieldset, options, true))
concat(content_tag(:legend, legend)) unless legend.blank?
concat(content)
concat("</fieldset>")