Take the 2-minute tour ×

I want to make chain selects part inside my Formtastic form. But is it possible to set custom ids for multiple selects for future AJAX replacement?

This doesn't work:

<%= semantic_form_for [:admin, @production_year] do |f| %>
  <%= f.inputs do %>
    <%= f.input :car_model, :label => "CarModel", :as => :select, :collection => Brand.find(:all, :order => "name ASC"), :id => "brand_id" %>
  <% end %>
<% end %>
share|improve this question

1 Answer 1

up vote 11 down vote accepted

Options should be passed to the input_html hash, like so:

<%= f.input :car_model, :input_html => { :id => "brand_id" } %>
share|improve this answer
It works, thanks –  BazZy Oct 15 '11 at 18:22

Your Answer


