0

I need to update the options of my second select box when my firt select box change, but i dont know how to do this.

I want to select all Stores from Client

my .html.erb

    <div class="field">
        <%= f.label :client_id %><br>
        <%= f.select :client_id, Client.all.collect {|c| [c.name, c.id]} %>
    </div>

    <div class="field">
        <%= f.label :store_id %><br>
        <%= f.select :store_id, Store.where(:client_id => :client_id).collect {|l| [store.name, store.id]} %>
    </div>

I'm thinking of using JQuery to do this. But how do I update the select box? Is there any simple solution to this?

Raj
  • 22,346
  • 14
  • 99
  • 142

0 Answers0