On Aug 29, 2011, at 8:27 AM, Dave Castellano wrote:
> Hi,
>
> Anybody know why :onchange works here...
> <%= select_tag "Minisections",
> options_from_collection_for_select
> (@minisections, :id, :title, :selected
> => @minisection.id), {:onChange => "{alert('Minisection has been
> changed
> to x !')}"} %>
>
> but NOT here (to call a function)...
> <script type="text/javascript">
> function xyz() {
> "{alert('Minisection has been changed to x !')}"}
> </script>
>
> <%= select_tag "Minisections",
> options_from_collection_for_select
> (@minisections, :id, :title, :selected
> => @minisection.id),
> {:onChange => "xyz()"} %>
>
> The function is at the top of the .html.erb page. I have used a
> similar
> format with :onclick and it works fine.
Visit your rendered page in a browser, view source, and copy all. Then
go to http://validator.w3.org and use the Direct Input tab and paste.
Validate your page. If it passes there, then enable Firebug in your
copy of Firefox, open up the console section, and visit your page. You
either have an HTML/DOM error or a JavaScript error. Once you figure
out which one you're dealing with in this case, you can proceed to a
fix.
Walter
--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment