field_set_tag

field_set_tag(legend = nil, options = nil, &block)
Instance Public methods

Creates a field set for grouping HTML form elements.

legend will become the fieldset's title (optional as per W3C). options accept the same values as tag.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<%= field_set_tag do %>
  <p><%= text_field_tag 'name' %></p>
<% end %>
# => <fieldset><p><input id="name" name="name" type="text" /></p></fieldset>
 
<%= field_set_tag 'Your details' do %>
  <p><%= text_field_tag 'name' %></p>
<% end %>
# => <fieldset><legend>Your details</legend><p><input id="name" name="name" type="text" /></p></fieldset>
 
<%= 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>
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.