0
<%= 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 ,这可能吗?

4

1 回答 1

0

How about:

<%= 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 %>

I didn't test the code. Just giving u some idea which might help. : )

于 2013-06-07T14:38:36.170 回答