instance method datalist

Ruby on Rails edge

Since edge

Signature

datalist(method, choices = nil, html_options = {})

Wraps ActionView::Helpers::FormTagHelper#datalist_tag for form builders.

<%= form_with model: @post do |f| %>
  <%# Wire the input to the datalist using the same derived id: %>
  <%= f.text_field :country, list: f.field_id(:country, :datalist) %>
  <%= f.datalist  :country, ["Argentina", "Brazil", "Chile"] %>
<% end %>

Please refer to the documentation of the base helper for details.

Parameters

method req
choices opt = nil
html_options opt = {}
Source
# File actionview/lib/action_view/helpers/form_options_helper.rb, line 954
      def datalist(method, choices = nil, html_options = {})
        @template.datalist_tag(field_id(method, "datalist"), choices, html_options)
      end

Defined in actionview/lib/action_view/helpers/form_options_helper.rb line 954 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionView::Helpers::FormBuilder

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close