Forum: Ruby on Rails select box selected on value ? w option_for_select

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ee0293412faca21e4ebf3326ed9d5f8c?d=identicon&s=25 Kad Kerforn (kadoudal)
on 2007-01-21 16:35
I have a select box in my view, with an option for select,  a variable
for selected value, and an Ajax observe_field

<select name="most[criteria]" id="most_criteria"
style="display:inline;width:12em;" >
<%= options_for_select({ "most cheerful" => "1", "most beautiful" =>
"2", "most displayed" => "3"}, @sort_criteria) %>

        <%= observe_field("most_criteria",
              :update => "results_table",
              :url => { :action => :list , :params =>
@params.merge({:page=> nil })},
              :with => "'sort='+value",
              :on => "changed")

when changed I get the params[:sort] set to the seelcted value....
but setting @sort_criteria to params[:sort] doesn't select anything at
what's the correct params to be set ?


This topic is locked and can not be replied to.