Hello All,
From the given blog below you will get to know about redirection of any form after submission or custom $form_state['redirect] in drupal 7:-
First you need to override form_alter by usind drupal hook function hook_form_alter. To change the form_state['redirect],put this code in your hook_form_alter like this:-
function MODULENAME_form_alter(&$form, &$form_state, $form_id){
switch ($form_id) {
case 'application_node_form':
$nodeId = '';
$nodeId = $form['nid']['#value'];
if(empty($nodeId)){
$form['actions']['submit']['#submit'][] = '_application_form_submit';
}
break;
default:
# code...
break;
}
}
Then write code in your form submit handler:-
function _application_form_submit($form, &$form_state){
$form_state['redirect'] = 'confirmation-page';
}
Please note: you need to use $form['actions]['submit']['#submit'][] instead of $form['#submit'].
0 Comment(s)