In the course of my Rails project, I've found myself wanting a button_to_remote function. I've had a search through Trac and I've seen patches have already been submitted, but my implementation is a little different. Instead of delegating to button_to_function, it acts more like button_to. It wraps a button in a form (with the relevant URL in the action), and the onclick handler of the form has the Prototype AJAX call. This has the advantage that it will continue to work when Javascript is disabled - just like form_remote_tag.

Anyway, I've posted a preliminary patch at Parked at Loopia. It needs more tests, and currently you can't specify a method, so it's not great with resources, but is it something I should spend the time to polish so I can submit a "proper" patch?


PGP.sig (186 Bytes)

look at submit_to_remote

Ah. Thank you. I'll get my coat.

PGP.sig (186 Bytes)