Hi, This is probably not the best place to post this question but I wanted to know whether using multiple form tags in the same view page should be avoided or it is not a problem? I have heard few people saying that one must avoid using multiple forms on the same page but I never got a convincing explanation for the same. I need some thoughts on this. Thanks, Chirantan --~--~---------~--~----~------------~-------~--~----~ 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 Mon, Dec 8, 2008 at 4:07 AM, Chirantan <chirantan.rajhans-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have heard few people saying that > one must avoid using multiple forms on the same page but I never got a > convincing explanation for the same.I''ve never heard that, and can''t imagine why anyone would think it a problem. I''ve certainly had projects that required multiple forms per page. FWIW, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 agree with Hassan. If you want to give your pages multiple functionality you have to be able to use multiple forms. Just look at Amazon, for example. After you have chosen a book/other and it''s in your cart you have a form to check out but they also offer selecting more items. Are both things one and the same or are they run by the same form? I hardly think so. Pepe On Dec 8, 11:17 am, "Hassan Schroeder" <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mon, Dec 8, 2008 at 4:07 AM, Chirantan <chirantan.rajh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I have heard few people saying that > > one must avoid using multiple forms on the same page but I never got a > > convincing explanation for the same. > > I''ve never heard that, and can''t imagine why anyone would think it a > problem. I''ve certainly had projects that required multiple forms per page. > > FWIW, > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
POST data is not structured, so while you can use multiple forms on the same page, there could also be namespace conflicts. The resulting query string (in case of a conflict) could be really bizarre and prone to subtle bugs. Not a problem when it''s you writing the code or when the page is stupid-simple. Problem if you are doing complicated stuff and others might inherit the code. If you want to see how Amazon implemented their form, Firebug is your friend. I''m not trying to convince, just offer a possible explanation :) On Dec 9, 2008, at 9:26 AM, pepe wrote:> > I agree with Hassan. If you want to give your pages multiple > functionality you have to be able to use multiple forms. Just look at > Amazon, for example. After you have chosen a book/other and it''s in > your cart you have a form to check out but they also offer selecting > more items. Are both things one and the same or are they run by the > same form? I hardly think so. > > Pepe > > On Dec 8, 11:17 am, "Hassan Schroeder" <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> On Mon, Dec 8, 2008 at 4:07 AM, Chirantan >> <chirantan.rajh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> I have heard few people saying that >>> one must avoid using multiple forms on the same page but I never >>> got a >>> convincing explanation for the same. >> >> I''ve never heard that, and can''t imagine why anyone would think it a >> problem. I''ve certainly had projects that required multiple forms >> per page. >> >> FWIW, >> -- >> Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > >--~--~---------~--~----~------------~-------~--~----~ 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 Tue, Dec 9, 2008 at 4:24 PM, s.ross <cwdinfo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > POST data is not structured, so while you can use multiple forms on > the same page, there could also be namespace conflicts. The resulting > query string (in case of a conflict) could be really bizarre and prone > to subtle bugs.Yes, you have to be careful with multiple forms on the page to not have duplicate element IDs and whatnot, particularly if you''re using JavaScript. However, you can only /submit/ one form at a time, so there should be no problem on the back end. And I''m not sure what that second sentence means, since POST data isn''t delivered as a "query string". Can you clarify? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Well, POST data is actually delivered as-if a hidden query string. So, for a GET request, you have an HTTP QUERY_STRING and for a POST request you have a RAW_POST_DATA. Both are functionally equivalent and neither are scoped. Look, it can and does work, and there''s no reason to believe it will stop any time soon. But why use multiple <form> tags when one will do? Are they posting to different actions? Do they expect to know the contents of fields in the other form? Should the user expect to know the behavior of hitting enter when in one form or the other (can they really tell they are in a different form)? I''m not a fan, but if there''s a clear argument why this is a simplifying practice, I''m all ears. On Dec 9, 2008, at 4:35 PM, Hassan Schroeder wrote:> Yes, you have to be careful with multiple forms on the page to not > have duplicate element IDs and whatnot, particularly if you''re using > JavaScript. However, you can only /submit/ one form at a time, so > there should be no problem on the back end. > > And I''m not sure what that second sentence means, since POST data > isn''t delivered as a "query string". > Can you clarify?--~--~---------~--~----~------------~-------~--~----~ 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 Tue, Dec 9, 2008 at 5:18 PM, s.ross <cwdinfo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Well, POST data is actually delivered as-if a hidden query string. So, > for a GET request, you have an HTTP QUERY_STRING and for a POST > request you have a RAW_POST_DATA. Both are functionally equivalentMmm. Well, they both deliver data, so I suppose you could say that. Angels, pins, tomato, tomahto, whatever :-)> Look, it can and does work, and there''s no reason to believe it will > stop any time soon. But why use multiple <form> tags when one will do? > Are they posting to different actions?Of course. Why else would you do it?> Do they expect to know the contents of fields in the other form?Not in any example I''ve developed (or seen).> Should the user expect to know > the behavior of hitting enter when in one form or the other (can they > really tell they are in a different form)?If they don''t understand what''s going on, someone''s done a crappy job of UX design, but that applies to so many things :-) -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---