Mike
2006-Dec-01 00:08 UTC
Weird problem with RUBY and AJAX (form_remote_tag and submit_tag)
Hello, I am trying to implement the depot sample application of "Agile programming with rails", everrithing goes good until came to AJAX stuff, When I changed the button_to for submit_tag I have no HTML code generated for invoking the action using AJAX, I read the troubleshooting section and everything is OK, any Idea of what could be happening? The code in index.rhml is <% form_remote_tag :url => {:action => :add_to_cart, :id => product } do %> <%= submit_tag "Add to Cart" %> <% end %> and the resulting form has nothing, just a couple of blank lines in the place that should show the button. Thank you --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jeff Pritchard
2006-Dec-01 03:32 UTC
Re: Weird problem with RUBY and AJAX (form_remote_tag and su
Mike wrote:> Hello, > > The code in index.rhml is > > > <% form_remote_tag :url => {:action => :add_to_cart, :id => product > > > and the resulting form has nothing, just a couple of blank lines in the > > place that should show the button. >You left off the = on the opening <%, so the form_remote_tag line doesn''t output anything. In general, you use <% for "figuring things out", like setting a variable to the result of a calculation, and you use <%= for lines where you want the stuff in there to create some output into the html stream. jp -- 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 -~----------~----~----~----~------~----~------~--~---
Jeff Pritchard ha escrito:> Mike wrote: > > Hello, > > > > The code in index.rhml is > > > > > > <% form_remote_tag :url => {:action => :add_to_cart, :id => product > > > > > > and the resulting form has nothing, just a couple of blank lines in the > > > > place that should show the button. > > > > You left off the = on the opening <%, so the form_remote_tag line > doesn''t output anything. > > In general, you use <% for "figuring things out", like setting a > variable to the result of a calculation, and you use <%= for lines where > you want the stuff in there to create some output into the html stream. > > jp > > -- > Posted via http://www.ruby-forum.com/.Tried also that but didn''t work, still trying. Thank you --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jeff Pritchard
2006-Dec-01 06:09 UTC
Re: Weird problem with RUBY and AJAX (form_remote_tag and su
Mike wrote:> Jeff Pritchard ha escrito: > >> > >> jp >> >> -- >> Posted via http://www.ruby-forum.com/. > > Tried also that but didn''t work, still trying. > > Thank youOh! I stopped reading when I "saw" the missing You are using form_remote_tag the way one would use form_for. form_remote_tag doesn''t use a do/end block. Try form_remote_for. jp -- 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 -~----------~----~----~----~------~----~------~--~---
Alex Wayne
2006-Dec-01 06:59 UTC
Re: Weird problem with RUBY and AJAX (form_remote_tag and su
Jeff Pritchard wrote:> Mike wrote: >> Jeff Pritchard ha escrito: >> >>> > >>> jp >>> >>> -- >>> Posted via http://www.ruby-forum.com/. >> >> Tried also that but didn''t work, still trying. >> >> Thank you > > Oh! I stopped reading when I "saw" the missing > > You are using form_remote_tag the way one would use form_for. > form_remote_tag doesn''t use a do/end block. Try form_remote_for. > > jp<% form_remote_tag do %> <%= text_field ''foo'', ''bar'' %> <% end %> is the proper way to do forms as of 1.2/edge So if you are using that style, be sure you are on 1.2 or edge rails. Otherwise everything inside your form block will dissapear. -- 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 -~----------~----~----~----~------~----~------~--~---
Francis Sinson
2006-Dec-01 13:44 UTC
Re: Weird problem with RUBY and AJAX (form_remote_tag and su
Mike wrote:> Hello, > > I am trying to implement the depot sample application of "Agile > programming with rails", everrithing goes good until came to AJAX > stuff, > > When I changed the button_to for submit_tag I have no HTML code > generated for invoking the action using AJAX, I read the > troubleshooting section and everything is OK, any Idea of what could be > > happening? > > > The code in index.rhml is > > > <% form_remote_tag :url => {:action => :add_to_cart, :id => product > > > > } do %> > > > <%= submit_tag "Add to Cart" %> > <% end %> > > and the resulting form has nothing, just a couple of blank lines in the > > place that should show the button. > > > Thank you<%= form_remote_tag :url => {:action => :add_to_cart, :id => product } %> ... <%= end_form_tag %> -- 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 -~----------~----~----~----~------~----~------~--~---