Hi all, I''m using a set of radio buttons, which when selected will transfer the control to a javascript function. But the issue is that the javascript function isn''t triggered. Is there any error in my code? Given below is the code. <% @types.each do |type|%> #@types was declared in the controller <%= type.name %><input type="radio" name= "type" value= <%type.id>onclick= "myfunc();"> <% end %> The above code is in a partial and the javascript function is in an rhtml page. My javascript function <%= javascript_include_tag "prototype" %> <%= javascript_include_tag "defaults" %> <script type="text/javascript"> function myfunc() { alert("Hi"); } </script> I have no clue on why this is happening and I believe someone can help me. Thanks Chris -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> <%= type.name %><input type="radio" name= "type" > value= <%type.id>onclick= "myfunc();"> >... the way the code is pasted here on the forum, it seems there is an error with some spacings...(the onclick is the continuation of the value attribute, and there are no qoutes on value (as well as a ''='' to display the type.id output): <input type="radio" name="type" value="<%= type.id %> onclick="myfunc();" /> -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks Shai, That was the error. You saved my day. Chris -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---