Collection_select with :selected option


#1

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


#2

Hey. Is there nobody using this?


#3

Hi, could you explain what you’re trying to do exactly so that people
can chime in?

-Conrad


#4

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


#5

Have a look here: http://shiningthrough.co.uk/blog/show/6

On Mar 30, 12:08 pm, David S. removed_email_address@domain.invalid