Forum: Ruby on Rails collection_select default

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.
Ryan L. (Guest)
on 2006-05-16 00:36
Hi,

I have a form where i have two drop down lists formed by using the
collection_select helper.

I need the second list "selected" item to change depending on what was
selected in the first list. I am currently using an onChange ajax call
when the first list is changed, but I cannot get the second lists
default value to change.

I have read that if I set the @variable.attribute this will be the
default selected item, but for some reason this only seems to work with
select lists and not collection_select. Is there a way to make one of
the items selected in the list?

Thanks,
Ryan L.
This topic is locked and can not be replied to.