module ActionView::Helpers::FormTagHelper

def button_tag(content_or_options = nil, options = nil, &block)


# =>
button_tag "Checkout", data: { disable_with: "Please wait..." }

# =>
button_tag "Save", data: { confirm: "Are you sure?" }

by the unobtrusive JavaScript driver.
button when the form is submitted. This feature is provided
used as the value for a disabled version of the submit
* :disable_with - Value of this parameter will be
processed normally, otherwise no action is taken.
the question specified. If the user accepts, the form is
unobtrusive JavaScript drivers will provide a prompt with
* confirm: 'question?' - If present, the

this library is no longer on by default. This library integrated with the following options:
Prior to Rails 7, Rails shipped with a JavaScript library called @rails/ujs on by default. Following Rails 7,

==== Deprecated: Rails UJS attributes

#
# Ask me!
# =>
button_tag 'Reset', type: 'reset', disabled: true

# =>
button_tag 'Button', type: 'button'

# =>
button_tag 'Reset', type: 'reset'

# =>
button_tag
==== Examples

* Any other key creates standard HTML options for the tag.
use this input.
* :disabled - If true, the user will not be able to
* :data - This option can be used to add custom data attributes.
==== Options

a button tag with type submit, if type is not given.
so this helper will also accept a block. By default, it will create
the button tag does allow for richer labels such as images and emphasis,
submit tag but it isn't supported in legacy browsers. However,
JavaScript, for example. You can use the button tag as a regular
reset button or a generic button which can be used in
Creates a button element that defines a submit button,
def button_tag(content_or_options = nil, options = nil, &block)
  if content_or_options.is_a? Hash
    options = content_or_options
  else
    options ||= {}
  end
  options = { "name" => "button", "type" => "submit" }.merge!(options.stringify_keys)
  if block_given?
    content_tag :button, options, &block
  else
    content_tag :button, content_or_options || "Button", options
  end
end

def check_box_tag(name, value = "1", checked = false, options = {})

# =>
check_box_tag 'eula', 'accepted', false, disabled: true

# =>
check_box_tag 'tos', 'yes', false, class: 'accept_tos'

# =>
check_box_tag 'receive_email', 'yes', true

# =>
check_box_tag 'rock', 'rock music'

# =>
check_box_tag 'accept'
==== Examples

* Any other key creates standard HTML options for the tag.
* :disabled - If set to true, the user will not be able to use this input.
==== Options

Creates a check box form input tag.
def check_box_tag(name, value = "1", checked = false, options = {})
  html_options = { "type" => "checkbox", "name" => name, "id" => sanitize_to_id(name), "value" => value }.update(options.stringify_keys)
  html_options["checked"] = "checked" if checked
  tag :input, html_options
end

def color_field_tag(name, value = nil, options = {})

# =>
color_field_tag 'color', '#DEF726', class: 'special_input', disabled: true

# =>
color_field_tag 'color', nil, class: 'special_input'

# =>
color_field_tag 'color', '#DEF726'

# =>
color_field_tag 'name'

==== Examples

Supports the same options as #text_field_tag.

==== Options

Creates a text field of type "color".
def color_field_tag(name, value = nil, options = {})
  text_field_tag(name, value, options.merge(type: :color))
end

def convert_direct_upload_option_to_url(options)

def convert_direct_upload_option_to_url(options)
  if options.delete(:direct_upload) && respond_to?(:rails_direct_uploads_url)
    options["data-direct-upload-url"] = rails_direct_uploads_url
  end
  options
end

def date_field_tag(name, value = nil, options = {})

# =>
date_field_tag 'date', '01/01/2014', class: 'special_input', disabled: true

# =>
date_field_tag 'date', nil, class: 'special_input'

# =>
date_field_tag 'date', '01/01/2014'

# =>
date_field_tag 'name'

==== Examples

Supports the same options as #text_field_tag.

==== Options

Creates a text field of type "date".
def date_field_tag(name, value = nil, options = {})
  text_field_tag(name, value, options.merge(type: :date))
end

def datetime_field_tag(name, value = nil, options = {})

* :step - The acceptable value granularity.
* :max - The maximum acceptable value.
* :min - The minimum acceptable value.

Supports the same options as #text_field_tag. Additionally, supports:

==== Options

Creates a text field of type "datetime-local".
def datetime_field_tag(name, value = nil, options = {})
  text_field_tag(name, value, options.merge(type: "datetime-local"))
end

def email_field_tag(name, value = nil, options = {})

# =>
email_field_tag 'email', 'email@example.com', class: 'special_input', disabled: true

# =>
email_field_tag 'email', nil, class: 'special_input'

# =>
email_field_tag 'email', 'email@example.com'

# =>
email_field_tag 'name'

==== Examples

Supports the same options as #text_field_tag.

==== Options

Creates a text field of type "email".
def email_field_tag(name, value = nil, options = {})
  text_field_tag(name, value, options.merge(type: :email))
end

def extra_tags_for_form(html_options)

def extra_tags_for_form(html_options)
  authenticity_token = html_options.delete("authenticity_token")
  method = html_options.delete("method").to_s.downcase
  method_tag = \
    case method
    when "get"
      html_options["method"] = "get"
      ""
    when "post", ""
      html_options["method"] = "post"
      token_tag(authenticity_token, form_options: {
        action: html_options["action"],
        method: "post"
      })
    else
      html_options["method"] = "post"
      method_tag(method) + token_tag(authenticity_token, form_options: {
        action: html_options["action"],
        method: method
      })
    end
  if html_options.delete("enforce_utf8") { default_enforce_utf8 }
    utf8_enforcer_tag + method_tag
  else
    method_tag
  end
end

def field_id(object_name, method_name, *suffixes, index: nil, namespace: nil)

case).
element, sharing a common id root (post_title, in this
aria-describedby attribute referencing the
the call to text_field_tag declares an
In the example above, the element built by

<%= tag.span("is blank", id: field_id(:post, :title, :error) %>
<%= text_field_tag :post, :title, aria: { describedby: field_id(:post, :title, :error) } %>
<%= label_tag :post, :title %>

attribute name.
Return the value generated by the FormBuilder for the given

field combination
Generate an HTML id attribute value for the given name and
def field_id(object_name, method_name, *suffixes, index: nil, namespace: nil)
  if object_name.respond_to?(:model_name)
    object_name = object_name.model_name.singular
  end
  sanitized_object_name = object_name.to_s.gsub(/\]\[|[^-a-zA-Z0-9:.]/, "_").delete_suffix("_")
  sanitized_method_name = method_name.to_s.delete_suffix("?")
  [
    namespace,
    sanitized_object_name.presence,
    (index unless sanitized_object_name.empty?),
    sanitized_method_name,
    *suffixes,
  ].tap(&:compact!).join("_")
end

def field_name(object_name, method_name, *method_names, multiple: false, index: nil)


<%# =>
<%= text_field_tag :post, :tag, name: field_name(:post, :tag, multiple: true) %>

<%# =>
<%= text_field_tag :post, :title, name: field_name(:post, :title, :subtitle) %>

attribute name.
Return the value generated by the FormBuilder for the given

field combination
Generate an HTML name attribute value for the given name and
def field_name(object_name, method_name, *method_names, multiple: false, index: nil)
  names = method_names.map! { |name| "[#{name}]" }.join
  # a little duplication to construct fewer strings
  case
  when object_name.blank?
    "#{method_name}#{names}#{multiple ? "[]" : ""}"
  when index
    "#{object_name}[#{index}][#{method_name}]#{names}#{multiple ? "[]" : ""}"
  else
    "#{object_name}[#{method_name}]#{names}#{multiple ? "[]" : ""}"
  end
end

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

# =>


<% end %>

<%= text_field_tag 'name' %>


<%= field_set_tag nil, class: 'format' do %>

# =>
Your details


<% end %>

<%= text_field_tag 'name' %>


<%= field_set_tag 'Your details' do %>

# =>


<% end %>

<%= text_field_tag 'name' %>


<%= field_set_tag do %>
==== Examples

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

Creates a field set for grouping HTML form elements.
def field_set_tag(legend = nil, options = nil, &block)
  output = tag(:fieldset, options, true)
  output.safe_concat(content_tag("legend", legend)) unless legend.blank?
  output.concat(capture(&block)) if block_given?
  output.safe_concat("</fieldset>")
end

def file_field_tag(name, options = {})

# =>
file_field_tag 'file', accept: 'text/html', class: 'upload', value: 'index.html'

# =>
file_field_tag 'user_pic', accept: 'image/png,image/gif,image/jpeg'

# =>
file_field_tag 'resume', value: '~/resume.doc'

# =>
file_field_tag 'picture', disabled: true

# =>
file_field_tag 'avatar', class: 'profile_input'

# =>
file_field_tag 'attachment'
==== Examples

* :accept - If set to one or multiple mime-types, the user will be suggested a filter when choosing a file. You still need to set up model validations.
* :multiple - If set to true, *in most updated browsers* the user will be allowed to select multiple files.
* :disabled - If set to true, the user will not be able to use this input.
* Creates standard HTML attributes for the tag.
==== Options

was left blank, a StringIO object.
The specified URL will then be passed a File object containing the selected file, or if the field

<% end %>
<%= submit_tag %>
<%= file_field_tag "file" %>
<%= form_tag '/upload', multipart: true do %>

to set the multipart option for the form tag:
Creates a file upload field. If you are using file uploads then you will also need
def file_field_tag(name, options = {})
  text_field_tag(name, nil, convert_direct_upload_option_to_url(options.merge(type: :file)))
end

def form_tag(url_for_options = {}, options = {}, &block)


# form with custom authenticity token
form_tag('http://far.away.com/form', authenticity_token: "cf50faa3fe97702ca1ae")

# form without authenticity token
form_tag('http://far.away.com/form', authenticity_token: false)

# =>

form_tag(false, method: :get)

# =>
<%= form_tag('/posts', remote: true) %>

# =>

<% end -%>
<%= submit_tag 'Save' %>

<%= form_tag('/posts') do -%>

# =>

form_tag('/upload', multipart: true)

# => ... ...
form_tag('/posts/1', method: :put)

# =>
form_tag('/posts')
==== Examples

* Any other key creates standard HTML attributes for the tag.
* :enforce_utf8 - If set to false, a hidden input with name utf8 is not output.
submit behavior. By default this behavior is an ajax submit.
* :remote - If set to true, will allow the Unobtrusive JavaScript drivers to control the
support browsers without JavaScript.
authenticity token from the meta tag, so embedding is unnecessary unless you
This is helpful when you're fragment-caching the form. Remote forms get the
by setting config.action_view.embed_authenticity_token_in_remote_forms = false.
(by passing false). Remote forms may omit the embedded authenticity token
pass custom authenticity token string, or to not add authenticity_token field at all
* :authenticity_token - Authenticity token to use in the form. Use only if you need to
is added to simulate the verb over post.
If "patch", "put", "delete", or another verb is used, a hidden input with name _method
* :method - The method to use when submitting the form, usually either "get" or "post".
* :multipart - If set to true, the enctype is set to "multipart/form-data".
==== Options

ActionController::Base#url_for. The method for the form defaults to POST.
Starts a form tag that points the action to a URL configured with url_for_options just like
def form_tag(url_for_options = {}, options = {}, &block)
  html_options = html_options_for_form(url_for_options, options)
  if block_given?
    form_tag_with_body(html_options, capture(&block))
  else
    form_tag_html(html_options)
  end
end

def form_tag_html(html_options)

def form_tag_html(html_options)
  extra_tags = extra_tags_for_form(html_options)
  tag(:form, html_options, true) + extra_tags
end

def form_tag_with_body(html_options, content)

def form_tag_with_body(html_options, content)
  output = form_tag_html(html_options)
  output << content.to_s if content
  output.safe_concat("</form>")
end

def hidden_field_tag(name, value = nil, options = {})

value="" onchange="alert('Input collected!')" autocomplete="off" />
# => hidden_field_tag 'collected_input', '', onchange: "alert('Input collected!')"

# =>
hidden_field_tag 'token', 'VUBJKB23UIVI1UU1VOBVI@'

# =>
hidden_field_tag 'tags_list'
==== Examples

* Creates standard HTML attributes for the tag.
==== Options

data that should be hidden from the user.
Creates a hidden form input field used to transmit data that would be lost due to HTTP's statelessness or
def hidden_field_tag(name, value = nil, options = {})
  text_field_tag(name, value, options.merge(type: :hidden, autocomplete: "off"))
end

def html_options_for_form(url_for_options, options)

def html_options_for_form(url_for_options, options)
  options.stringify_keys.tap do |html_options|
    html_options["enctype"] = "multipart/form-data" if html_options.delete("multipart")
    # The following URL is unescaped, this is just a hash of options, and it is the
    # responsibility of the caller to escape all the values.
    if url_for_options == false || html_options["action"] == false
      html_options.delete("action")
    else
      html_options["action"] = url_for(url_for_options)
    end
    html_options["accept-charset"] = "UTF-8"
    html_options["data-remote"] = true if html_options.delete("remote")
    if html_options["data-remote"] &&
       embed_authenticity_token_in_remote_forms == false &&
       html_options["authenticity_token"].blank?
      # The authenticity token is taken from the meta tag in this case
      html_options["authenticity_token"] = false
    elsif html_options["authenticity_token"] == true
      # Include the default authenticity_token, which is only generated when its set to nil,
      # but we needed the true value to override the default of no authenticity_token on data-remote.
      html_options["authenticity_token"] = nil
    end
  end
end

def image_submit_tag(source, options = {})

# =>
image_submit_tag("save.png", data: { confirm: "Are you sure?" })

# =>
image_submit_tag("agree.png", disabled: true, class: "agree_disagree_button")

# =>
image_submit_tag("search.png", class: 'search_button', alt: 'Find')

# =>
image_submit_tag("purchase.png", disabled: true)

# =>
image_submit_tag("login.png")
==== Examples

processed normally, otherwise no action is taken.
prompt with the question specified. If the user accepts, the form is
* confirm: 'question?' - This will add a JavaScript confirm

==== Data attributes

* Any other key creates standard HTML options for the tag.
* :disabled - If set to true, the user will not be able to use this input.
* :data - This option can be used to add custom data attributes.
==== Options

source is passed to AssetTagHelper#path_to_image

Displays an image which when clicked will submit the form.
def image_submit_tag(source, options = {})
  options = options.stringify_keys
  src = path_to_image(source, skip_pipeline: options.delete("skip_pipeline"))
  tag :input, { "type" => "image", "src" => src }.update(options)
end

def label_tag(name = nil, content_or_options = nil, options = nil, &block)

# =>
label_tag 'name', nil, class: 'small_label'

# =>
label_tag 'name', 'Your name'

# =>
label_tag 'name'
==== Examples

* Creates standard HTML attributes for the tag.
==== Options

Creates a label element. Accepts a block.
def label_tag(name = nil, content_or_options = nil, options = nil, &block)
  if block_given? && content_or_options.is_a?(Hash)
    options = content_or_options = content_or_options.stringify_keys
  else
    options ||= {}
    options = options.stringify_keys
  end
  options["for"] = sanitize_to_id(name) unless name.blank? || options.has_key?("for")
  content_tag :label, content_or_options || name.to_s.humanize, options, &block
end

def month_field_tag(name, value = nil, options = {})

* :step - The acceptable value granularity.
* :max - The maximum acceptable value.
* :min - The minimum acceptable value.

Supports the same options as #text_field_tag. Additionally, supports:

==== Options

Creates a text field of type "month".
def month_field_tag(name, value = nil, options = {})
  text_field_tag(name, value, options.merge(type: :month))
end

def number_field_tag(name, value = nil, options = {})

# =>
number_field_tag 'quantity', '1', class: 'special_input', disabled: true

# =>
number_field_tag 'quantity', nil, min: 1, max: 10, step: 2

# =>
number_field_tag 'quantity', nil, min: 1, max: 10

# =>
number_field_tag 'quantity', nil, within: 1...10

# =>
number_field_tag 'quantity', nil, in: 1...10

# =>
number_field_tag 'quantity', nil, max: 9

# =>
number_field_tag 'quantity', nil, min: 1

# =>
number_field_tag 'quantity', nil, class: 'special_input'

# =>
number_field_tag 'quantity', '1'

# =>
number_field_tag 'quantity'

==== Examples

* :step - The acceptable value granularity.
* :within - Same as :in.
:max values.
* :in - A range specifying the :min and
* :max - The maximum acceptable value.
* :min - The minimum acceptable value.

Supports the same options as #text_field_tag. Additionally, supports:

==== Options

Creates a number field.
def number_field_tag(name, value = nil, options = {})
  options = options.stringify_keys
  options["type"] ||= "number"
  if range = options.delete("in") || options.delete("within")
    options.update("min" => range.min, "max" => range.max)
  end
  text_field_tag(name, value, options)
end

def password_field_tag(name = "password", value = nil, options = {})

# =>
password_field_tag 'pin', '1234', maxlength: 4, size: 6, class: "pin_input"

# =>
password_field_tag 'confirm_pass', nil, disabled: true

# =>
password_field_tag 'key', nil, maxlength: 16

# =>
password_field_tag 'token', '', size: 15

# =>
password_field_tag 'masked', nil, class: 'masked_input_field'

# =>
password_field_tag 'secret', 'Your secret here'

# =>
password_field_tag 'pass'
==== Examples

* Any other key creates standard HTML attributes for the tag.
* :maxlength - The maximum number of characters that the browser will allow the user to enter.
* :size - The number of visible characters that will fit in the input.
* :disabled - If set to true, the user will not be able to use this input.
==== Options

Creates a password field, a masked text field that will hide the users input behind a mask character.
def password_field_tag(name = "password", value = nil, options = {})
  text_field_tag(name, value, options.merge(type: :password))
end

def radio_button_tag(name, value, checked = false, options = {})

# =>
radio_button_tag 'color', "green", true, class: "color_input"

# =>
radio_button_tag 'time_slot', "3:00 p.m.", false, disabled: true

# =>
radio_button_tag 'receive_updates', 'no', true

# =>
radio_button_tag 'favorite_color', 'maroon'
==== Examples

* Any other key creates standard HTML options for the tag.
* :disabled - If set to true, the user will not be able to use this input.
==== Options

select from a group of options.
Creates a radio button; use groups of radio buttons named the same to allow users to
def radio_button_tag(name, value, checked = false, options = {})
  html_options = { "type" => "radio", "name" => name, "id" => "#{sanitize_to_id(name)}_#{sanitize_to_id(value)}", "value" => value }.update(options.stringify_keys)
  html_options["checked"] = "checked" if checked
  tag :input, html_options
end

def range_field_tag(name, value = nil, options = {})

Supports the same options as #number_field_tag.

==== Options

Creates a range form element.
def range_field_tag(name, value = nil, options = {})
  number_field_tag(name, value, options.merge(type: :range))
end

def sanitize_to_id(name)

see http://www.w3.org/TR/html4/types.html#type-name
def sanitize_to_id(name)
  name.to_s.delete("]").tr("^-a-zA-Z0-9:.", "_")
end

def search_field_tag(name, value = nil, options = {})

# =>
search_field_tag 'search', 'Enter your search query here', class: 'special_input', disabled: true

# =>
search_field_tag 'search', nil, class: 'special_input'

# =>
search_field_tag 'search', 'Enter your search query here'

# =>
search_field_tag 'name'

==== Examples

Supports the same options as #text_field_tag.

==== Options

Creates a text field of type "search".
def search_field_tag(name, value = nil, options = {})
  text_field_tag(name, value, options.merge(type: :search))
end

def select_tag(name, option_tags = nil, options = {})

#
# =>
# =>
select_tag "people", options_from_collection_for_select(@people, "id", "name"), prompt: "Select something"

# =>
select_tag "people", options_from_collection_for_select(@people, "id", "name"), include_blank: "All"

# =>
select_tag "people", options_from_collection_for_select(@people, "id", "name"), include_blank: true

#
# =>
# =>
# =>
# =>
select_tag "people", raw("")

#
select_tag "people", options_from_collection_for_select(@people, "id", "name", "1")

#
select_tag "people", options_from_collection_for_select(@people, "id", "name")
==== Examples

* Any other key creates standard HTML attributes for the tag.
* :prompt - Create a prompt option with blank value and the text asking user to select something.
* :include_blank - If set to true, an empty option will be created. If set to a string, the string will be used as the option's content and the value will be empty.
* :disabled - If set to true, the user will not be able to use this input.
* :multiple - If set to true, the selection will allow multiple choices.
==== Options

associated records. option_tags is a string containing the option tags for the select box.
Helpers::FormOptions can be used to create common select boxes such as countries, time zones, or

choice selection box.
Creates a dropdown selection box, or if the :multiple option is set to true, a multiple
def select_tag(name, option_tags = nil, options = {})
  option_tags ||= ""
  html_name = (options[:multiple] == true && !name.end_with?("[]")) ? "#{name}[]" : name
  if options.include?(:include_blank)
    include_blank = options[:include_blank]
    options = options.except(:include_blank)
    options_for_blank_options_tag = { value: "" }
    if include_blank == true
      include_blank = ""
      options_for_blank_options_tag[:label] = " "
    end
    if include_blank
      option_tags = content_tag("option", include_blank, options_for_blank_options_tag).safe_concat(option_tags)
    end
  end
  if prompt = options.delete(:prompt)
    option_tags = content_tag("option", prompt, value: "").safe_concat(option_tags)
  end
  content_tag "select", option_tags, { "name" => html_name, "id" => sanitize_to_id(name) }.update(options.stringify_keys)
end

def set_default_disable_with(value, tag_options)

def set_default_disable_with(value, tag_options)
  data = tag_options.fetch("data", {})
  if tag_options["data-disable-with"] == false || data["disable_with"] == false
    data.delete("disable_with")
  elsif ActionView::Base.automatically_disable_submit_tag
    disable_with_text = tag_options["data-disable-with"]
    disable_with_text ||= data["disable_with"]
    disable_with_text ||= value.to_s.clone
    tag_options.deep_merge!("data" => { "disable_with" => disable_with_text })
  end
  tag_options.delete("data-disable-with")
end

def submit_tag(value = "Save changes", options = {})


# =>
submit_tag "Save", data: { confirm: "Are you sure?" }

# =>
submit_tag "Complete sale", data: { disable_with: "Submitting..." }

pass :data => { disable_with: false } Defaults to value attribute.
provided by the unobtrusive JavaScript driver. To disable this feature for a single submit tag
disabled version of the submit button when the form is submitted. This feature is
* :disable_with - Value of this parameter will be used as the value for a
the form is processed normally, otherwise no action is taken.
drivers will provide a prompt with the question specified. If the user accepts,
* confirm: 'question?' - If present the unobtrusive JavaScript

this library is no longer on by default. This library integrated with the following options:
Prior to Rails 7, Rails shipped with the JavaScript library called @rails/ujs on by default. Following Rails 7,

==== Deprecated: Rails UJS attributes

# =>
submit_tag "Edit", class: "edit_button"

# =>
submit_tag nil, class: "form_submit"

# =>
submit_tag "Save edits", disabled: true

# =>
submit_tag "Edit this article"

# =>
submit_tag
==== Examples

* Any other key creates standard HTML options for the tag.
* :disabled - If true, the user will not be able to use this input.
* :data - This option can be used to add custom data attributes.
==== Options

Creates a submit button with the text value as the caption.
def submit_tag(value = "Save changes", options = {})
  options = options.deep_stringify_keys
  tag_options = { "type" => "submit", "name" => "commit", "value" => value }.update(options)
  set_default_disable_with value, tag_options
  tag :input, tag_options
end

def telephone_field_tag(name, value = nil, options = {})

# =>
telephone_field_tag 'tel', '0123456789', class: 'special_input', disabled: true

# =>
telephone_field_tag 'tel', nil, class: 'special_input'

# =>
telephone_field_tag 'tel', '0123456789'

# =>
telephone_field_tag 'name'

==== Examples

Supports the same options as #text_field_tag.

==== Options

Creates a text field of type "tel".
def telephone_field_tag(name, value = nil, options = {})
  text_field_tag(name, value, options.merge(type: :tel))
end

def text_area_tag(name, content = nil, options = {})

# =>
text_area_tag 'comment', nil, class: 'comment_input'

# =>
text_area_tag 'description', "Description goes here.", disabled: true

# =>
text_area_tag 'body', nil, size: "25x10"

# =>
text_area_tag 'body', nil, rows: 10, cols: 25

# =>
text_area_tag 'bio', @user.bio

# =>
text_area_tag 'post'
==== Examples

* Any other key creates standard HTML attributes for the tag.
If you need unescaped contents, set this to false.
* :escape - By default, the contents of the text input are HTML escaped.
* :disabled - If set to true, the user will not be able to use this input.
* :cols - Specify the number of columns in the textarea
* :rows - Specify the number of rows in the textarea
* :size - A string specifying the dimensions (columns by rows) of the textarea (e.g., "25x10").
==== Options

Creates a text input area; use a textarea for longer text inputs such as blog posts or descriptions.
def text_area_tag(name, content = nil, options = {})
  options = options.stringify_keys
  if size = options.delete("size")
    options["cols"], options["rows"] = size.split("x") if size.respond_to?(:split)
  end
  escape = options.delete("escape") { true }
  content = ERB::Util.html_escape(content) if escape
  content_tag :textarea, content.to_s.html_safe, { "name" => name, "id" => sanitize_to_id(name) }.update(options)
end

def text_field_tag(name, value = nil, options = {})

# =>
text_field_tag 'ip', '0.0.0.0', maxlength: 15, size: 20, class: "ip-input"

# =>
text_field_tag 'payment_amount', '$0.00', disabled: true

# =>
text_field_tag 'zip', nil, maxlength: 5

# =>
text_field_tag 'address', '', size: 75

# =>
text_field_tag 'request', nil, class: 'special_input'

# =>
text_field_tag 'search', nil, placeholder: 'Enter search term...'

# =>
text_field_tag 'query', 'Enter your search query here'

# =>
text_field_tag 'name'
==== Examples

* Any other key creates standard HTML attributes for the tag.
(through helpers.placeholder..).
If set to true, use the translation found in the current I18n locale
* :placeholder - The text contained in the field by default which is removed when the field receives focus.
* :maxlength - The maximum number of characters that the browser will allow the user to enter.
* :size - The number of visible characters that will fit in the input.
* :disabled - If set to true, the user will not be able to use this input.
==== Options

or a search query.
Creates a standard text field; use these text fields to input smaller chunks of text like a username
def text_field_tag(name, value = nil, options = {})
  tag :input, { "type" => "text", "name" => name, "id" => sanitize_to_id(name), "value" => value }.update(options.stringify_keys)
end

def time_field_tag(name, value = nil, options = {})

* :include_seconds - Include seconds and ms in the output timestamp format (true by default).
* :step - The acceptable value granularity.
* :max - The maximum acceptable value.
* :min - The minimum acceptable value.

Supports the same options as #text_field_tag. Additionally, supports:

==== Options

Creates a text field of type "time".
def time_field_tag(name, value = nil, options = {})
  text_field_tag(name, value, options.merge(type: :time))
end

def url_field_tag(name, value = nil, options = {})

# =>
url_field_tag 'url', 'http://rubyonrails.org', class: 'special_input', disabled: true

# =>
url_field_tag 'url', nil, class: 'special_input'

# =>
url_field_tag 'url', 'http://rubyonrails.org'

# =>
url_field_tag 'name'

==== Examples

Supports the same options as #text_field_tag.

==== Options

Creates a text field of type "url".
def url_field_tag(name, value = nil, options = {})
  text_field_tag(name, value, options.merge(type: :url))
end

def utf8_enforcer_tag

to customize the tag.
Creates the hidden UTF-8 enforcer tag. Override this method in a helper
def utf8_enforcer_tag
  # Use raw HTML to ensure the value is written as an HTML entity; it
  # needs to be the right character regardless of which encoding the
  # browser infers.
  '<input name="utf8" type="hidden" value="&#x2713;" autocomplete="off" />'.html_safe
end

def week_field_tag(name, value = nil, options = {})

* :step - The acceptable value granularity.
* :max - The maximum acceptable value.
* :min - The minimum acceptable value.

Supports the same options as #text_field_tag. Additionally, supports:

==== Options

Creates a text field of type "week".
def week_field_tag(name, value = nil, options = {})
  text_field_tag(name, value, options.merge(type: :week))
end