From the Agile Rails book: "Why do we check for an HTTP POST request? Its a good habit to get into. Requests that change the server state should be sent using POST, not GET requests. Thats why we overrode the link_to defaults in the form and made it generate a POST. But that works only if the user has JavaScript enabled. Adding a test to the controller finds this case and ignores the request.)" Can someone confirm this or am I way off in my interpretation? I had no idea sending a POST requires JavaScript to be enabled. -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
They mean that they''re doing javascript trickery to make a hypertext link submit a form. Links normally send a GET request. So no, POST requests don''t *require* javascript... but the normal way in which they''re issued from a browser is by submitting a form, not by clicking a link. b Michael Chow wrote:> From the Agile Rails book: > > "Why do we check for an HTTP POST request? Its a good habit to get > into. > Requests that change the server state should be sent using POST, not GET > requests. Thats why we overrode the link_to defaults in the form and > made > it generate a POST. But that works only if the user has JavaScript > enabled. > Adding a test to the controller finds this case and ignores the > request.)" > > Can someone confirm this or am I way off in my interpretation? I had no > idea sending a POST requires JavaScript to be enabled. >--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sending a POST request as a result of clicking a link requires Javascript. Sending a POST from a form doesn''t. On Apr 23, 6:41 am, Michael Chow <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> From the Agile Rails book: > > "Why do we check for an HTTP POST request? It''s a good habit to get > into. > Requests that change the server state should be sent using POST, not GET > requests. That''s why we overrode the link_to defaults in the form and > made > it generate a POST. But that works only if the user has JavaScript > enabled. > Adding a test to the controller finds this case and ignores the > request.)" > > Can someone confirm this or am I way off in my interpretation? I had no > idea sending a POST requires JavaScript to be enabled. > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Ah, of course. So it would be something like <a href="#" action=".......">. Alright, thanks. -- 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/22/07, Michael Chow <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Ah, of course. So it would be something like <a href="#" > action=".......">.No. <form action="..." method="post"> -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.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 -~----------~----~----~----~------~----~------~--~---
> No. <form action="..." method="post">Right, but I was referring to making a regular link send a post request. -- 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 -~----------~----~----~----~------~----~------~--~---
1. POST method primary used in <form method="POST> does not require javascript (unless you are using <form method="GET"> and want change it to "POST" by some conditions) 2. POST method can be used with regular <a href="#"> using javascript, mostly in AJAX requests,. "link_to" create GET request. "link_to_remote" create POST request with AJAX and yes it will be look like "#" unless you describe otherwise. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
alexey.Creopolis wrote:> 1. POST method primary used in <form method="POST> does not require > javascript (unless you are using <form method="GET"> and want change > it to "POST" by some conditions) > 2. POST method can be used with regular <a href="#"> using javascript, > mostly in AJAX requests,. > > "link_to" create GET request. > "link_to_remote" create POST request with AJAX and yes it will be look > like "#" unless you describe otherwise.Could a POST request not also be created with link_to :method => :post? Would that not be the more ''appropriate'' option when not using AJAX? -- 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 -~----------~----~----~----~------~----~------~--~---
Michael Chow wrote:> alexey.Creopolis wrote: >> 1. POST method primary used in <form method="POST> does not require >> javascript (unless you are using <form method="GET"> and want change >> it to "POST" by some conditions) >> 2. POST method can be used with regular <a href="#"> using javascript, >> mostly in AJAX requests,. >> >> "link_to" create GET request. >> "link_to_remote" create POST request with AJAX and yes it will be look >> like "#" unless you describe otherwise. > > Could a POST request not also be created with link_to :method => :post? > Would that not be the more ''appropriate'' option when not using AJAX?That wouldn''t be feasible unless you are using Javascript. link_to create a <a href> tag, in other word, link_to only create a hyperlink. I don''t see how one can construct a post request with a hyperlink. -- 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 -~----------~----~----~----~------~----~------~--~---
> I don''t see how one can construct a post request with a hyperlink.I just decided to go and simply try it :) There''s a eureka moment. var f = document.createElement(''form''); f.style.display = ''none''; this.parentNode.appendChild(f); f.method = ''POST''; f.action = this.href;f.submit();return false;" It creates some elaborate code for an ''onclick'' event. -- 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 -~----------~----~----~----~------~----~------~--~---