<%= form_tag 'select_domain', :url => administer_admin_domain_path(:id), :method => :get do %>
<%= select_tag "id", options_from_collection_for_select(@domains, :id, :caption), :onchange => "this.form.submit();" %>
<% end %>
我希望选中的选项ID在我提交的表单的URL中是:id,这可能吗?
答案 0 :(得分:0)
怎么样:
<%= form_tag 'select_domain', :url => administer_admin_domains_path, :method => :get do %>
<%= select_tag "id", options_from_collection_for_select(@domains, :id, :caption), :onchange=>"this.form.action=this.form.action + '/' + this.value; this.form.submit(); %>
<% end %>
我没有测试代码。只是给你一些可能有帮助的想法。 :)