Form_remote_tag can only have one submit button?

I setup a form_remote_tag with several submit buttons, all of them share
the same name
( ‘do_action’ ) and their values differ.

eg.
button1 named do_action with value ACTION1
button2 named do_action with value ACTION2,
etc

No matter which button I press the value passed is always the one
defined for the first of these buttons ( the correct value associated
with the pressed button is not passed to the controller ).

This behavior does not occur with a regular form_tag, which works as it
should passing the value associated with the pressed button.

Anyone have any insight into this, surely this is not intended behavior?

-Andy

It’s the way prototype serializes the form fields. You need to hack
something with hidden form fields which get populated via javascript
when
one of your submit buttons get pressed.

ajax forms don’t work the same as standard html forms, at least as far
as
submission to the server goes.

basically, in the end, the form data gets serialized into a parameter
string

field1=this&field2=that&field3=foobar

if you have 2 form fields (this includes buttons) with the same name,
you
can see what happens.

field1=this&field1=that

here is a test (save to your myapp/public directory:

load it in the browser and you can see what prototype does to the form
in
order to prepare the request

Chris

Gothca, thanks for the explanation guys.

-Andy

Chris H. wrote:

ajax forms don’t work the same as standard html forms, at least as far
as
submission to the server goes.

basically, in the end, the form data gets serialized into a parameter
string

field1=this&field2=that&field3=foobar

if you have 2 form fields (this includes buttons) with the same name,
you
can see what happens.

field1=this&field1=that

here is a test (save to your myapp/public directory:

load it in the browser and you can see what prototype does to the form
in
order to prepare the request

Chris