Hi, I have a shopping cart page. I have a button to update the cart if quantities are changed etc and also have buttons next to each item so they can be deleted from the cart. How can I tell from within an action which button was pressed so that I know which action to perform? I think I can only do this with forms as far as I know, but because of the way the page is laid out, I''d have to have one form within another which isn''t allowed. This needs to work with javascript turned off, so using that is a no no. Any ideas? Many thanks, Jord --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 9/21/06, Jordan Elver <jordan.elver-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > I have a shopping cart page. I have a button to update the cart if > quantities are changed etc and also have buttons next to each item so > they can be deleted from the cart. > > How can I tell from within an action which button was pressed so that > I know which action to perform? I think I can only do this with forms > as far as I know, but because of the way the page is laid out, I''d > have to have one form within another which isn''t allowed. > > This needs to work with javascript turned off, so using that is a no no.If you want to stay away from using a GET to do your delete, and you can''t rely on JavaScript, could you change your delete buttons to checkboxes and just handle it on the update? -- James --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> If you want to stay away from using a GET to do your delete, and you > can''t rely on JavaScript, could you change your delete buttons to > checkboxes and just handle it on the update?I could do that. It''s just that my design doesn''t work that way at the moment. I could change the design to fit, but I think that buttons to perform those actions make more sense. I''ve actually managed to add buttons for all of the actions now and then in the controller I detect which button was clicked and act accordingly. However, I did want to add some RJS at some point, but this technique doesn''t work with remote_form_tag because when the form is serialised using Prototype js, all of the buttons are shown in the params, not just the one clicked :( Anyone got any ideas about that? Cheers, Jord --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---