<?php
function MODULENAME_form_alter(&$form, $form_state, $form_id){
global $user;
switch ($form_id) {
// This is our form ID.
case 'YOUR_NODE_FORM_ID': // like page_node_form(for node/add/page)
$form['buttons']['submit']['#submit'][] = 'redirect_this_form';
break;
}
}
function redirect_this_form($form, &$form_state) {
if ($form_state['nid']) {
$node = node_load(array('nid' => $form_state['nid']));
switch($node->type) {
case 'page':
$form_state['redirect'] = 'pages'; // you should specicify here where want to redirect the form after submission
}
}
}
?>
How to redirect a form in drupal
under:
Drupal,
drupal theme
0 comments:
Post a Comment