how to get the value of dropdown box selected using collect_select()?

Hi,

I am trying to get the value of 'contenttype_id' value from the 'streams' table like:

<%= collection_select (:stream, :contenttype_id,@contenttypes,:id,:name),{},{onchange => "switchdiv(value)";}%>

here i want to recieve the vaule of selected option in switchdiv( ) as argument. my collection_select dropdown box contain names as video,audio,image and speech with having values as 1,2,3 and 4 respectively.

so if i hardcoded as value = 1 in switchdev() function like switchdiv(1) am able do functionality what i implemented in switchdiv function,

instead of hardcdoing i want to get the "value" of "name" from dropdownbox. ex:if i select name as 'video' i shoud get the value as '1' can anyone give idea to get the value from collect_select? thanks Srikanth

Hi,

I am trying to get the value of 'contenttype_id' value from the 'streams' table like:

<%= collection_select (:stream, :contenttype_id,@contenttypes,:id,:name),{},{onchange => "switchdiv(value)";}%>

here i want to recieve the vaule of selected option in switchdiv( ) as argument. my collection_select dropdown box contain names as video,audio,image and speech with having values as 1,2,3 and 4 respectively.

so if i hardcoded as value = 1 in switchdev() function like switchdiv(1) am able do functionality what i implemented in switchdiv function,

instead of hardcdoing i want to get the "value" of "name" from dropdownbox. ex:if i select name as 'video' i shoud get the value as '1' can anyone give idea to get the value from collect_select? thanks

switchdiv($F('id_of_the_select_tag')) will do the trick if you have
prototype library loaded

Fred