Multiple actions and POST requests

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

On 9/21/06, Jordan E. [email protected] 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

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 :frowning:

Anyone got any ideas about that?

Cheers,
Jord