Forum: Ruby on Rails Select changed event for collection_select

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
3ed68b7e96aedd03c27a3558659faa96?d=identicon&s=25 bins (Guest)
on 2007-06-14 07:48

I'm using collection_select in one of the Rails application as follows.

<%= collection_select("occupation","id",@occupations,"id","name")%>

Could you please tell how I can call a javascript function on selecting
an item.

thanks in advance
F4082c9f3569050037c0f99c2e96fea0?d=identicon&s=25 Kupsztal (Guest)
on 2008-02-20 18:49
(Received via mailing list)
Hi bins,

Could you point me to a solution for this problem ?
I've stuck on it for about 2 days now. Cannot find any useful
suggestions on the web.


On Jun 14 2007, 5:48 am, bins <>
2d8132658d56e51f19ace1c68e48b6aa?d=identicon&s=25 Thorsten Mueller (thorsten)
on 2008-02-20 18:58
use the onchange event of the enclosing select tag

if you use rails select in the html-options add something like:
:onchange => 'change_procedure(this.value)'
This topic is locked and can not be replied to.