You probably don't want onClick; onChange is more likely to be more
usable with a select box, but either way, just add it to the f.select
(here's an example I've used with a select_tag, but the principle's
the same) :
<%= select_tag("note[notes]", options_for_select([["quick note",
""], ["no answer", "Called, no answer"], ["no show", "Appointment no
show"]]), :onchange => "if(this.value != '' && confirm('Create quick
note?')){this.form.submit()}") %>
The onClick event is inconsistent between browsers when used on a select
tag.
However, that being said, it's time to start using Unobtrusive
JavaScript (UJS) techniques. It's the way Rails 3 does it, and it's time
for us all to start doing it.
http://en.wikipedia.org/wiki/Unobtrusive_JavaScript
--
Posted via http://www.ruby-forum.com/.