Drop down menu

Hey,

Sorry another question that has been bugging me :frowning:

How could I reproduce the functionality of:

<%= link_to cuisine.name, :action => ‘search’, :id => cuisine.id, :sort
=> “name” %>

in a drop down menu with a submit button. basically I want the user to
be able to choose a cuisine from a drop-down menu, click “submit” and
then that should pass the id to the search action. Thanks!

just an update, you can ignore the :sort part, so just:

<%= link_to cuisine.name, :action => ‘search’, :id => cuisine.id %>

First, you’d place the select inside a form and then set the select so
that it returns the cuisine.id in the select. Add a submit button and
then your method specified in the form tag will receive the id as

<%= start_form_tag( {:action => ‘select_cuisine’} ) %>
<%= select( :cuisine, :id, Cuisine.find_all.collect { |c| [c.name,
c.id ] } ) %>
<%= submit_tag “Submit” %>
<%= end_form_tag %>

Then, when the “select_cuisine” method is called the id will be in
params[:cuisine][:id].

I didn’t test the code above, but it should give you the idea.

David S.