i have a form with multiple selects from other tables in my database.
i hava a relationship between vestigingen (locations) and organisaties (organisations) i would like to hide the option for that specific organisation untill it is selected in the dropdown.
so when it is selected i would like to choose which location. i would like to hide the location when no organisation is selected
screenshot:

i hope you understand what i mean.
thanks
EDIT: this is my _form.html.erb
<%= form_for(@contracten) do |f| %>
<% if @contracten.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@contracten.errors.count, "error") %> prohibited this contracten from being saved:</h2>
<ul>
<% @contracten.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :naam %><br />
<%= f.text_field :naam %>
</div>
<div class="field">
<%= f.label :omschrijving %><br />
<%= f.text_area :omschrijving %>
</div>
<div class="field">
<%= f.label :organisatie %><br />
<%= f.select :organisatieid, options_for_select(@organisaties.map{ |f| [f.naam, f.id] }), :include_blank => true %>
</div>
<div class="field">
<%= f.label :vestiging %><br />
<%= f.select :vestigingid, options_for_select(@vestigingens.map{ |f| [f.naam, f.id] }), :include_blank => true %>
</div>
<div class="field">
<%= f.label :Beheerder %><br />
<%= f.select :persoonid, options_for_select(@personen.map{ |f| [f.naam, f.id] }), :include_blank => true %>
</div>
<div class="field">
<%= f.label :contractsoort %><br />
<%= f.select :contractsoortid, options_for_select(@contractsoorten.map{ |f| [f.naam, f.id] }), :include_blank => true %>
</div>
<div class="field">
<%= f.label :datumingang %><br />
<%= f.datetime_select :datumingang %>
</div>
<div class="field">
<%= f.label :datumeinde %><br />
<%= f.date_select :datumeinde %>
</div>
<div class="field">
<%= f.label :contractduur %><br />
<%= f.number_field :contractduur, :placeholder => 'in jaren' %>
</div>
<div class="field">
<%= f.label :opzegtermijn %><br />
<%= f.number_field :opzegtermijn, :placeholder => 'In Maanden' %>
</div>
<div class="field">
<%= f.label :betalingsperiode_eenheid_id %><br />
<%= f.number_field :betalingsperiodeeenheidid, :disabled => 'true' %>
</div>
<div class="field">
<%= f.label :betalingstermijn %><br />
<%= f.number_field :betalingstermijn %>
</div>
<br>
<div class="actions">
<%= f.submit "Toevoegen", :class => 'button3' %>
</div>
<% end %>
<br>
Take a look at the first example on here
http://api.jquery.com/val/
Should give you an indication of how to do this with JQuery
Basically you need to assign an onchange event to your select and then show your secondary select when val is not null or equals a certain option.
If you post your code a more specific answer could be provided