# Multiple actions and POST requests

**URL:** <https://www.ruby-forum.com/t/multiple-actions-and-post-requests/69539>\
**Category:** Rails\
**Created:** [September 21, 2006, 6:08pm UTC](https://www.ruby-forum.com/t/multiple-actions-and-post-requests/69539 "2006-09-21T18:08:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jordelver](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@jordelver](https://www.ruby-forum.com/u/jordelver)\
**Post date:** [September 21, 2006, 6:08pm UTC](https://www.ruby-forum.com/t/multiple-actions-and-post-requests/69539/1 "2006-09-21T18:08:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jordelver](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@jordelver](https://www.ruby-forum.com/u/jordelver)\
**Post date:** [September 22, 2006, 4:45pm UTC](https://www.ruby-forum.com/t/multiple-actions-and-post-requests/69539/2 "2006-09-22T16:45:35Z")

</div>

On 9/21/06, Jordan E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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

---

<div class="post-metadata">

**Author:** ![jordelver](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@jordelver](https://www.ruby-forum.com/u/jordelver)\
**Post date:** [September 22, 2006, 8:58pm UTC](https://www.ruby-forum.com/t/multiple-actions-and-post-requests/69539/3 "2006-09-22T20:58:19Z")

</div>

> 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
