Collection_select

I have posted before about collection_select but have not gotten what I
am working on to work. I have even searched the archives for similar
discussions and am at a little bit of a loss because some have claimed
to have fixed the problem but I still can’t get it to work for me.

What I am trying to do is simply add the :selected option to the
collection_select helper. This is what I got:

<%= collection_select(“user”, “w_country” , Countrycode.find( :all,
:order =>
‘country’ ), :id, :country, :selected => 159573, :onchange => func )
%>

I simply want it to select the country code that has the specified id.
The onchange is for when a selection is made the drop down reverts back
to a link on a form. Has anyone gotten the combination of these two to
work? Thanks,

-S

On Fri, Apr 18, 2008 at 5:23 AM, Shandy N.
[email protected] wrote:

<%= collection_select(“user”, “w_country” , Countrycode.find( :all,
:order =>
‘country’ ), :id, :country, :selected => 159573, :onchange => func )
%>

I had something similar.

What I ended up doing is manually coding the select tag, and then
adding an ‘options for select’ tag underneath within the manual select
tag.

Works fine.

Remember, the helper methods are there to help, but if they get in the
way, don’t be afraid to get rid of them - or make a new one that does
exactly what you want.

Mikel