field_set_tag(legend = nil, options = nil, &block) public

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

  <% 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>
Show source
Register or log in to add new notes.