How can i achieve the :before and :success with form_for ? The same way we are using it with form_remote_tag.
<% form_remote_tag(:url => {:controller => "test",:action => "backup"},
:before => %($('message').innerHTML = "";Element.show('spinner')),
:success => %(Element.hide('spinner'))) do -%>
With a regular form_tag, the “success” part doesn’t really mean anything (because the user will have navigated away to a different page). However, you can mimic the behavior of the “before” part as follows:
Or, with form_for:
Note that the user may only see the spinner for a brief second before they navigate away to the next page.