I need to redirect a user after they complete a form. I want the form data to be processed as normal, but then I want to choose where the user is redirected to.
I have changed the value of $form['#action'], but that does not work, because the form is then submitted to the #action URL with the wrong $edit values. doh.
Kind of like hook_submit but invoked *after* the data is saved. Messing with the _submit means that I will have to save the data manually, and then redirect - and I think that's a bad idea.
I tried also using $form[#process]. The api.drupal.org site just says: 'INTERNAL, used to modify a form element'. I set the value on $form['#process'], and this works as planned but I did not plan this thing :) it is not the thing I need. It does it's work before the form is displayed, it seems.
Basically I need to overload _submit. Is this in any way possible?
The only other solution I see is to write some stuff to the form as hidden values, and then look for them in the $element value passed to the callback specified in #process, and redirect based on that. ugh.
Comments
There are two ways to accomplish this
or
At the moment the second mechanism has precendence, but that is a bug.
http://drupal.org/node/56089
That patch is needed to make the first mechanism have precedence.
--
The future is so Bryght, I have to wear shades.