Michael Pavling wrote:
> 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/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.