I ran into the same problem. The prototype library is being used for
the client-side AJAX serialization – specifically the Form.serialize()
method.
http://roberthanson.blogspot.com/2005/11/prototypejs-form.html
It appears that the serialize method does not know which button was
clicked. Therefore, it does not know which button to put into the
serialization. That is just my guess since by no means am I a
javascript expert.
Here is a workaround, though. Prepare yourself for an ugly hack 
<%= hidden_field_tag(‘commit’, ‘Preview’) %>
<%= submit_tag(‘Preview’, :name => ‘_commit’) %>
<%= submit_tag(‘Post Message’, :name => ‘_commit’,
:onclick => “Form.getInputs(this.form, null,
‘commit’)[0].value = ‘Post Message’”) %>
The trick here is to create a hidden input field named ‘commit’ that
will be serialized by the prototype javascript code. The default value
is ‘Preview’. The javascript attached to the ‘Post Message’ button will
change the value of the hidden field to be ‘Post Message’.
Hope this helps.
Blessings,
Tim P.
derek.haynes wrote:
I’ve run across a problem when attempting to submit a form with the
form_remote_tag when the form contains multiple submit buttons.
My form contains 2 submit buttons, a “Preview” button and a “Post
Message” button:
<%= submit_tag ‘Preview’ %>
<%= submit_tag ‘Post Message’ %>
When the form is submitted, the value of @params[‘commit’] is the
value of the first submit tag (‘Preview’ in this case) no matter what
button is used to submit the form.
This is not present when changing the form to a standard non-ajax form.
Any one else run across this problem or have a suggested fix?
–
Derek H.
HighGroove Studios - http://www.highgroove.com
Atlanta, GA
Keeping it Simple.
404.593.4879