views:

52

answers:

1

Say I have a Rails form like the following

 <% 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?

A: 

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.

shmichael