Howdy, This is one of those simple questions that is hard to search and find an answer for, probably because most people just ''get it''. Well, I have what I hope is a simple one. I have the following: <% form_remote_for(:chat_message, :url => chat_messages_path (@chat), :update => ''message'') do |f| %> <%= f.text_area :message %> <%= submit_tag "Send" %> <% end %> Works all fine and dandy but when I submit, the data is sent but I would like the text area to be blanked out again. It contains the submitted text. What am I doing wrong? Thanks, H --~--~---------~--~----~------------~-------~--~----~ 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 11/17/06, Hunter Hillegas <lists-HAWAbpnI61OZ1JSuHaJ1sQC/G2K4zDHf@public.gmane.org> wrote:> > Howdy, > > This is one of those simple questions that is hard to search and find > an answer for, probably because most people just ''get it''. > > Well, I have what I hope is a simple one. > > I have the following: > > <% form_remote_for(:chat_message, :url => chat_messages_path > (@chat), :update => ''message'') do |f| %> > <%= f.text_area :message %> > <%= submit_tag "Send" %> > <% end %> > > Works all fine and dandy but when I submit, the data is sent but I > would like the text area to be blanked out again. It contains the > submitted text. > > What am I doing wrong? > > Thanks, > H > > > >Hunter, Add an html id to your form_remote_for() and then in your RJS file: page.call ''Form.reset'', ''your_form'' Hope this helps. -- Zack Chandler http://depixelate.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 -~----------~----~----~----~------~----~------~--~---
Hunter Hillegas wrote:> <% form_remote_for(:chat_message, :url => chat_messages_path > (@chat), :update => ''message'') do |f| %> > <%= f.text_area :message %> > <%= submit_tag "Send" %> > <% end %>Contradicting Zack''s answer, here''s a snip from my post "How to chat": form_remote_for( :chat, :url=>{ :action=>:utter }, :html=>{ :id => ''chat_panel_''+panel_id.to_s, :style => ''display:inline'' }, :update=>''panel_''+panel_id.to_s+''_new_content_script'', :loading=>load, :complete=>comp, :after=>"chat_utterance.value='''';" ) do |f| Note the line :after => "chat_utterance.value='''';". If you don''t want to reset your entire form, you can just zilch out the one TEXTAREA. And my code zilches punitively, regardless if the submission worked. New question: How to do that with either RJS and/or Unobtrusive JavaScript? (Assuming raw JavaScript is, what, distasteful? ;-) -- Phlip --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---