I''m just starting to play with rjs, I have an index page with a remote_form_for to create new items. That''s working. However, after the ajax updates my container, the input form needs to be cleared. I''m not sure how to do that http://pastie.caboo.se/75318 tia linoj --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> I''m just starting to play with rjs, I have an index page with a > remote_form_for to create new items. That''s working. However, after > the ajax updates my container, the input form needs to be cleared. > I''m not sure how to do thatCan you show the partial _form ...? There is an error when you use @empty in this line:> page.replace_html ''create_form'', {:partial=>''form'', :object=> @empty}the @empty object is a Choice model and you are using it in your _form partial like a Form object.... ''text_field'' is not defined in a Choice object. -- 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 -~----------~----~----~----~------~----~------~--~---
thank you, yes, I realize the empty Choice object is not correct, that is my question. I''m looking for suggestion how to clear the form fields from the rjs. The _form.html.erb is quite simple <p> <b>Prompt</b><br /> <%= form.text_field :prompt %> </p> On Jul 2, 4:28 am, Moises Deniz <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I''m just starting to play with rjs, I have an index page with a > > remote_form_for to create new items. That''s working. However, after > > the ajax updates my container, the input form needs to be cleared. > > I''m not sure how to do that > > Can you show the partial _form ...? > > There is an error when you use @empty in this line: > > > page.replace_html ''create_form'', {:partial=>''form'', :object=> @empty} > > the @empty object is a Choice model and you are using it in your _form > partial like a Form object.... ''text_field'' is not defined in a Choice > object. > > -- > 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 -~----------~----~----~----~------~----~------~--~---
> I''m looking for suggestion how to clear the form fields from the rjs. > > The _form.html.erb is quite simple > > <p> > <b>Prompt</b><br /> > <%= form.text_field :prompt %> > </p>Ok, you can do this using rjs... first mark the form with an html id (''my_form''). After, you can use in the rjs template something like this: page[''my_form''].reset() -- 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 -~----------~----~----~----~------~----~------~--~---