我有一个表格,可以从我的数据库中的其他表中进行多项选择。
我在vestigingen(位置)和组织(组织)之间有关系我想隐藏该特定组织的选项,直到它在下拉列表中被选中。所以当它被选中时,我想选择哪个位置。我想在没有选择组织时隐藏位置
截屏:
我希望你明白我的意思。
谢谢
编辑:这是我的 _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>