I ran into the same problem. The prototype library is being used for
the client-side AJAX serialization – specifically the Form.serialize()
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
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’).value = ‘Post Message’”) %>
The trick here is to create a hidden input field named ‘commit’ that
change the value of the hidden field to be ‘Post Message’.
Hope this helps.
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
<%= 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?
HighGroove Studios - http://www.highgroove.com
Keeping it Simple.