Forum: Ruby on Rails collection_select with :selected option

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
David S. (Guest)
on 2007-03-29 16:28
Hi there.

I know that there are a lot of solutions that have been discussed for
this issue here already. However none of them did work for me. Either
the selected option did work, but not ":include_blank => true" or my
AJAX-code gots messed-up.

Is there a final solution for this?



Here my code:

  <%= collection_select("category_selection", "super_category_id",
                        @super_categories, :super_category_id, :name,
                        @selected_super_category_id,
                        {:onChange => remote_function(:update =>
"box_search",
                                                      :url => {:action
=> :search_by_category},
                                                      :submit =>
"category_selection_super_category") } ) -%>


Thanks
David
David S. (Guest)
on 2007-03-30 11:23
Hey. Is there nobody using this?
Conrad T. (Guest)
on 2007-03-30 13:52
(Received via mailing list)
Hi, could you explain what you're trying to do exactly so that people
can chime in?

-Conrad
David S. (Guest)
on 2007-03-30 15:08
Conrad T. wrote:
> Hi, could you explain what you're trying to do exactly so that people
> can chime in?

Hi. I'm trying to generate a HTML select-tag including the selected
option from a model object.

I've tried this with the collection_select, which does not include the
selected option. I've also tried options_from_collection_for_select,
which worked unless a blank option was included.

Thanks
David
Pingu (Guest)
on 2007-05-08 21:46
(Received via mailing list)
Have a look here: http://shiningthrough.co.uk/blog/show/6

On Mar 30, 12:08 pm, David S. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.