b.hutchison-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-22 05:05 UTC
Help with form.select in selection lists with option selected
In my view I have an option select and I want to have a default option selected, and it won''t necessarily be the first one. I load the form.select with an array, and I want the user''s previous choice to be selected. I save their choice in a cookie, and I can of course pass it into the view again, but how do I get it selected? AWDwRv2 shows an example on the top of page 486, where this is accomplished, but it doesn''t call out how it was done. Any help would be appreciated. - Brian Specific examples below... Snippet of view: <%= form.select(:carrier, CARRIERS ) %> Snippet of controller: @carrier = ''AC'' # I''ve tried also setting to ''Air Canada''. CARRIERS is an array, of the form: CARRIERS = [ [''Air Canada'', ''AC''], [''Alaska Airlines'', ''AS''], [''Virgin Atlantic'', ''VS''], ] --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---