Hi all. I''m having trouble with options_from_collection_for_select The selected value option doesn''t seem to get picked up. I''ve googled this but can''t seem to find any reference to such a bug. The form is definitely working, and sending back the right parameter - I can get the view to print the selected value on screen, but it''s not getting picked up in the relevant <options....> tag. the snippet from my partial is: <select id="pupil_set" name="pupil_set" onchange="submit();"> <%=options_from_collection_for_select(@pupil_sets, "id", "set_code", @params[:pupil_set]) %> </select> where the controller contains: @pupil_sets=PupilSet.find(:all) Any ideas anyone? Super-rapid Rails development has ground to a crawl :( -- Robert Jones
Yep - I was just being daft!! Missed out the .to_i at the end of @params[:pupil_set] Sorry for the wasted time. Robert Robert Jones wrote:> Hi all. I''m having trouble with options_from_collection_for_select > > The selected value option doesn''t seem to get picked up. I''ve googled > this but can''t seem to find any reference to such a bug. > > The form is definitely working, and sending back the right parameter - I > can get the view to print the selected value on screen, but it''s not > getting picked up in the relevant <options....> tag. > > the snippet from my partial is: > > <select id="pupil_set" name="pupil_set" onchange="submit();"> > <%=options_from_collection_for_select(@pupil_sets, "id", "set_code", > @params[:pupil_set]) %> > </select> > > where the controller contains: > > @pupil_sets=PupilSet.find(:all) > > Any ideas anyone? Super-rapid Rails development has ground to a crawl :( >