On this two submit button subject, have anyone successfully tried the
":name" technique in a form_remote_tag case? In the following example,
params[:preview] and params[:ok] are both present, so can't tell which
button is clicked, any idea how to get around this?
if i remember correctly, the way around this is to have a hidden field
in the form and when you click the submit button, you set the value on
the hidden field to indicate what button was clicked. you can then
check this hidden field value on the server.
hmm ... not sure why this can work. If I understand it correctly, A
hidden field is part of the submitted form, not associated with the
submit button. <%= hidden_field_tag ... %> will be submitted along
with the rest of the form, but still not sufficient to make a
distinction. Maybe I get you wrong, an example will be good.
off the top of my head...not tested. not even sure if you need the
submit() call in the onclicks as it may still get submitted because of
the submit buttons. give it a shot.