Say I have a Rails form like the following
<%开发者_JAVA技巧 form_for @model do |f| %>
<%= f.label :column %>
<%= f.check_box :column %>
<% end %>
Is there a way I can get the html id that will be generated for the 'column' check box? What would be great is if there was a way to add in
<%= f.observe_field :column, options %>
Anyone know how to add this to FormBuilder?
For generating an element's id programatically, see this. As it seems, there is no easy way out.
You could add this to FormBuilder by wrapping up certain field tags. See for example this.
精彩评论