I’m having some trouble with this select tag.
I have a simple search form that passes parameters with GET. I have the
search by name working fine but want to add a drop down list to search
by classification as well.
here is what i have:
<% form_tag items_path, :method => ‘get’ do %>
<%= link_to 'New Item', new_item_path %><%= text_field_tag :search, params[:search] %> | <%= select("class","id", @classifications.map {|u| [u.name,u.id]}) %> | <%= submit_tag "Search", :name => nil %> |
it works but the url looks like:
http://domain.com/items?search=&class[id]=1
because it is sending class[id]=1
i would like it to send just class=1 (or whatever the classification id
is)
also, is there a good way to add a :prompt (although i don’t think this
is possible with just a select tag) so if a user does not select a
classification then it will not pass a GET parameter.
thanks!