bigbanger
2007-Dec-21 09:25 UTC
Generating a form using form_tag/remote_form_tag in an RJS template??
Is there a way to use the form_tag/remote_form_tag helpers in an RJS template? I want to replace the innerHTML of a div with a remote form as the result of an AJAX request and I''m not having any luck getting it to work. I''m trying something like this: page.replace_html "delete_div", form_tag(:url=>"/listings") do submit_tag "Delete" end but that doesn''t work very well. The <form> element is generated but the block seems to be ignored. I''ve tried a million other variations and can''t get them to work either. Any way to use these helpers in an RJS template? If not, how else can I do what I''m trying to do? Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thorsten Mueller
2007-Dec-21 09:51 UTC
Re: Generating a form using form_tag/remote_form_tag in an R
put the stuff in a partial and render that: page.replace_html "delete_div", :partial => "my_form" -- 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 -~----------~----~----~----~------~----~------~--~---
bigbanger
2007-Dec-21 18:37 UTC
Re: Generating a form using form_tag/remote_form_tag in an R
Thanks, that seemed to do the trick, although I''m not clear on why the partial is required for this to work. Oh well... On Dec 21, 1:51 am, Thorsten Mueller <rails-mailing-l...@andreas- s.net> wrote:> put the stuff in a partial and render that: > > page.replace_html "delete_div", :partial => "my_form" > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---