mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
35 lines
1.1 KiB
Markdown
35 lines
1.1 KiB
Markdown
* `ActionView::Helpers::FormBuilder#id` returns the value
|
|
of the `<form>` element's `id` attribute. With a `method` argument, returns
|
|
the `id` attribute for a form field with that name.
|
|
|
|
<%= form_for @post do |f| %>
|
|
<%# ... %>
|
|
|
|
<% content_for :sticky_footer do %>
|
|
<%= form.button(form: f.id) %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
*Sean Doyle*
|
|
|
|
* `ActionView::Helpers::FormBuilder#field_id` returns the value generated by
|
|
the FormBuilder for the given attribute name.
|
|
|
|
<%= form_for @post do |f| %>
|
|
<%= f.label :title %>
|
|
<%= f.text_field :title, aria: { describedby: f.field_id(:title, :error) } %>
|
|
<%= tag.span("is blank", id: f.field_id(:title, :error) %>
|
|
<% end %>
|
|
|
|
*Sean Doyle*
|
|
|
|
* Add `tag.attributes` to transform a Hash into HTML Attributes, ready to be
|
|
interpolated into ERB.
|
|
|
|
<input <%= tag.attributes(type: :text, aria: { label: "Search" }) %> >
|
|
# => <input type="text" aria-label="Search">
|
|
|
|
*Sean Doyle*
|
|
|
|
|
|
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionview/CHANGELOG.md) for previous changes.
|