0
<%= form_tag url_for(new_manage_listing_media_path(3)),:method => 'get' do -%>
   <%= label_tag ':name', "Choose media:" %>      
   <%= select_tag "id", options_from_collection_for_select(@listing, "id", "name")%>
   <%= submit_tag("OK") %>
<% end %>

actually what i want is in form_tag url_for(new_manage_listing_media_path(3)), instead of 3 i want to put the select_tag's selected value.

Thanks, ariv

Lucas
  • 2,886
  • 1
  • 27
  • 40

1 Answers1

0

You have to use JavaScript to do what you're saying. Add an onUpdate handler to the select field, and update the action attribute for the form.

However, I think you can just leave out the three, and then the id value from the select will be used instead. Otherwise, name the select_tag something else, like lookup_id and use Model.find(params[:id] || params[:lookup_id]) in the controller, where Model is the model you're looking up.

sarahhodne
  • 9,796
  • 3
  • 39
  • 44