instance method
datalist
Ruby on Rails edge
Since edgeSignature
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
-
methodreq -
choicesopt = nil -
html_optionsopt = {}
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