2

I have a custom form which can be accessed from different places inside the website. The form itself is inside the admin overlay.
When the form is submitted, I want the user (administrator) to return to the place where he accessed the form. The form can also be accessed from within the overlay.
Inside the submit handler I use a form redirect to return but I don't have a clue how to determine the url of the previous page to return to.

// $_SERVER['REDIRECT_URL']? 
$redirect = 'set redirect url'
$form_state['redirect'] = $redirect;

1 Answer 1

1

If I'm not wrong by default the form redirect the user in the page where it was generate. But, if you want change it you can use the function drupal_get_destination and add it to your action="" simply by changing the $form['#action'] in your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.