I imagine there''s a simple solution for this. I want to click a checkbox and have a rails for submit immediately and save data to the database. However, since this is a checkbox there''s no need to render anything because either the checkbox is check or it''s not. For example: <%= form_remote_tag(:url => { :action => "save_data" }) %> <%= check_box("report", "word", :onclick => "this.form.submit()") %> <%= end_form_tag %> Then in the controller I have a method called "save_data" that does the usual active record saving of data, but I don''t need any rendering to be done -- I just need the data to be saved. If I leave out the "render :partial" statement I''m obviously told the template for "save_data" is missing. How can I get around this? -- 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 -~----------~----~----~----~------~----~------~--~---
On 4/6/07, MenDAKE <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I imagine there''s a simple solution for this. I want to click a checkbox > and have a rails for submit immediately and save data to the database. > However, since this is a checkbox there''s no need to render anything > because either the checkbox is check or it''s not. > > For example: > > <%= form_remote_tag(:url => { :action => "save_data" }) %> > <%= check_box("report", "word", :onclick => "this.form.submit()") %> > <%= end_form_tag %> > > Then in the controller I have a method called "save_data" that does the > usual active record saving of data, but I don''t need any rendering to be > done -- I just need the data to be saved. If I leave out the "render > :partial" statement I''m obviously told the template for "save_data" is > missing. How can I get around this?# Renders an empty response with status code 200 render :nothing => true - Andy Delcambre --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Andy Delcambre wrote:> On 4/6/07, MenDAKE <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> <%= end_form_tag %> >> >> Then in the controller I have a method called "save_data" that does the >> usual active record saving of data, but I don''t need any rendering to be >> done -- I just need the data to be saved. If I leave out the "render >> :partial" statement I''m obviously told the template for "save_data" is >> missing. How can I get around this? > > # Renders an empty response with status code 200 > render :nothing => true > > - Andy DelcambreThanks, that looks like what I need. However, now I have another question. It seems that putting a form.submit inside the Onclick of a checkbox doesn''t render the form ajax style. Instead of updating the div with the appropriate id the entire page is updated. Am I going about this wrong? -- 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 -~----------~----~----~----~------~----~------~--~---