ActionView::Helpers::FormTagHelper

Alias: fieldset_tag

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

Description

Creates a <fieldset>.

Arguments

Changing a value updates the ERB and HTML.

= nil
Adds a <legend> with the given string as its content at the start of the <fieldset>. nil or an empty string omits the <legend>. To pass only options, set this to nil. If you leave it out and pass only a hash (field_set_tag(class: "x")), the hash is converted to a string and used as the content of the <legend>.
options= {}
Common options

Rails handles these options the same way in every helper. Options the HTML spec does not allow on the <fieldset>, and ones this site considers rarely used, are not listed here.

Shared by all helpers

true adds disabled="disabled"; false omits it. The same goes for every HTML attribute in Rails' list (BOOLEAN_ATTRIBUTES), such as readonly, required and autofocus: any value other than false or nil adds it as attr="attr".
{active: true, hidden: false}
A hash gives the keys whose values are not false or nil, joined with spaces. An array gives its elements joined with spaces, after removing nil, false and empty strings (including whitespace-only strings).
{controller: "tags", tags_suggestions_value: ["ruby", "rails"]}
A hash adds data-* attributes, with _ in the keys converted to -. Array and hash values are converted to JSON strings.
{describedby: ["name_help", "name_error"], invalid: false}
Like :data, adds aria-* attributes. Array values are joined with spaces, leaving out nil and empty strings (nothing is added if none remain). For a hash value, the keys whose values are not false or nil are joined with spaces.
Any other options become HTML attributes of the <fieldset>; those with a nil value are left out.
&block= nil

ERB

Changes from the previous output: Added Removed Changed


          

HTML


          

Preview

Interacting with the preview updates the form submission.

Form submission

Form data

namevalue
Request body

Content-Type:


              

params