0
我有一個表單,其中有來自我數據庫中其他表格的多個選擇。Rails 3.2選擇記錄時下一個選項可用表格
我有一個vestigingen(地點)和organisaties(組織)之間的關係,我想隱藏該特定組織的選項,直到它在下拉列表中選中。 所以當它被選中時我想選擇哪個位置。我想隱藏的位置時,沒有任何組織選擇
截圖:
我希望你明白我的意思。
感謝
編輯:這是我的_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>
editted我的代碼與_form.html.erb :)如果你需要更多的代碼,我將提供 – 2012-07-09 11:39:02