I expect to be able to determine which button is clicked by testing
'params[:savecancel] == 'Cancel'. However, it doesn't work, both values are
in the request. I.e., Firebug reports the request as:
A cancel button is not something that should submit the form values in the first place, cancelling is just an action and not an update, so it’s better to just keep it a (either normal or ajax) link, i.e. . You can then style it to appear just like your submit button.
Quoting Ryan Bigg (Radar) <radarlistener@gmail.com>:
> Is this in an ajax form?
>
> The ajax form will only detect the first submit tag.
>
Is a remote_form_for an AJAX form? If so, yes this is.
I have been looking at del.icio.us which is where I stole the idea from.
Using the Firebug extension for Firefox I can see the HTML and GET/POST
requests and the responses. It's interesting. The "form" isn't really an
HTML form, it's a bunch of input tags. The cancel button does not make a
request to the server. And the "form" isn't replacing the content being
altered, it's still there but hidden, i.e., 'display: none' style/attribute.
Should be easy to delete the "form" and unhide the original content with some
JavaScript. I don't understand it all, but I have enough to explore. When I
have something working I'll write it up on my blog and post a link here.