What I'm doing is that I change the "Source" parameter in the URL, so when the user saves the form, he's then redirected to a special HTML page that is doing some stuff, and after that redirected to the original page.
First, at the beginning of my form I call a JavaScript page that will:
- record the actual "Source" into localStorage
- stop the page loading
- redirect to the same form but with a new "Source=" in the URL (e.g. "Source=/my/folder/my list/saving.html")
When the form is loaded with the correct "Source=" then, when the user will click "save", he will be redirected to "/my/folder/my list/saving.html".
That page will show him a progress bar, and, in the background, I do some operations (for example I check if there is no conflict into the calendar). If everything is OK I use the saved "Source" from localStorage to redirect the user to the original source.