Here is what I am doing. I do a form_remote_tag in order to update my
data.
I want to be able to prevent the user from going back to the form
with the browser back button, so by having it ajax
after the submit finishes I do a partial render to remove the form
from the page and the browsers cached version of that page no longer
has a form which is what I want.
The problem is that before the ajax call finishes, they could do
multiple hits of the submit button which will send the data to the
browser. I suspect there may be a better way to do this, not sure if
I’d have to write custom javascript however ?
Basically what I do is that I set a session variable
update_in_progress=true, then in the base controller if it’s not an
ajax call I set that to false. That seems to work fine as if I am in
my update(), if that is set it means the submit was hit twice and I
just ignore it. The problem is that I still have to handle so sort of
rendering that happens on the unwanted submits.
If I do render :nothing => true, it blows away anything that the
previous render partial had done from
the first submit. So if it had said “record updated successfully” that
then disappears.
If I do
render :update do |page|
do nothing
end
that seems to put some sort of javascript garbage onto my page, which
I have had problems with that in other places as well.
If I just call exit() to get out of the controller, that causes a
stack dump
Maybe there’s an easy answer here, but I don’t know what it is as of
yet …
thanks