I had been looking a 'RedirectURI*' string in the kernel classes, didn't expect it to be named following different pattern :) And RedirectIfDiscarded is there. Unfortunately, it doesn't seem to work... Here's my code:
While redirection after publishing works fine, the other one doesn't (works just as if there was no RedirectIfDiscarded variable). Any suggestions? By the way, it is version 3.9.1.
I use this on a production site to control redirection for content/edit after submission. The hidden input, 'RedirectIfDiscarded' redirects my users to the last uri accessed (before content/edit) after discarding the draft.
Thank you for the tip - it does work as expected so my problem is solved.
I did some testing, though. There seem to be two locations where redirect instruction may be placed: the initial 'do some action' form and the actual act (edit) form. While RedirectURIAfterPublish variable works fine in both, RedirectIfDiscarded doesn't seem to give any effect when placed in the initial form. That would mean we cannot precisely control what happens in case we discard a draft, we can only get back to the original or some generic location. It may be convenient enough, we'll see :)