I have the following code: <%= start_form_tag :action => ''index'', :sort => params[:my_select_box] %> <select name="my_select_box" onchange=''this.form.submit()''> <option value="name">Sort Alphabetically</option> <option value="rating DESC">Sort by Rating</option> </select> The problem is the first time the form gets submitted params[:my_select_box] is empty and so nothing happens. All I want to do is pass one of the values directly into the method. Another problem is when the page refreshes, the same thing is selected in the menu. I would like the option the user picked to be the currently selected one. Thanks in advance -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
DAve wrote:> I have the following code: > > <%= start_form_tag :action => ''index'', :sort => params[:my_select_box] > %> > <select name="my_select_box" onchange=''this.form.submit()''> > <option value="name">Sort Alphabetically</option> > <option value="rating DESC">Sort by Rating</option> > </select> > > > The problem is the first time the form gets submitted > params[:my_select_box] is empty and so nothing happens. All I want to do > is pass one of the values directly into the method. > > Another problem is when the page refreshes, the same thing is selected > in the menu. I would like the option the user picked to be the currently > selected one. > > Thanks in advanceHas nobody run into this problem before :( ? I''ve searched high and low on google to no avail. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---