laredotornado-8iDLEspWrrZBDgjK7y7TUQ@public.gmane.org
2008-Feb-13 06:23 UTC
adding some more javascript to run ...
Hi, I have a form where I''m adding multiple items. So I have an "Add New Item" link to the page. Here''s how I define it in the controller''s helper ... def add_item_link(name) link_to_function name do |page| page.insert_html :bottom, :ec_line_items, :partial => "ec_line_item", :object => EcLineItem.new end end The link is invoked on the page like so: <%= add_item_link "Add an item" %> My question is, let''s say I want an additional javascript function, "myFunc()" to run after the above HTML has been inserted. How do I modify the helper function above to execute "myFunc()" after it has done its thing? Thanks, - Dave --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Try this: def add_item_link(name) link_to_function name do |page| page.insert_html :bottom, :ec_line_items, :partial => "ec_line_item", :object => EcLineItem.new page << "myFunc();" end end -- 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 -~----------~----~----~----~------~----~------~--~---