hook_nodeapi

Form Redirection: A Special Case

Most of you are probably familiar with using the Form API (either via hook_form_alter or when building your own form) to set the destination a user is sent to after submitting a form.

<?php
function mymodule_form_alter($form_id, &$form) {
  if (
$form_id == 'page_node_form') {
   
$form['#redirect'] = 'my/new/page';
  }
}
?>

This usually works, but today I came across a special case.

What if you want to redirect users back to the referring page after they submit a new node? Sounds simple enough, right? You'd probably do something like this:

<?php

Subscribe to RSS - hook_nodeapi
© 2010 Greg Harvey. Drupal theme by Kiwi Themes.