Try
$form_state['redirect'] = "dir1/dir2/mypage";
Mike Munroe
2010-08-30 19:15:59
If you've only got one handler for your submit you could easily redirect with
function _mymodule_school_registration_submit(..args...) {
...
drupal_goto('somewhere');
}
I think the functionality is the same.
http://api.drupal.org/api/function/drupal_goto/6
I tend to avoid redirects so once you have met your deadline I would refactor your code. You can usually get away with out redirecting.
Your hook_form_alter()
implementation is not correct:
$form['#submit']
and $form['#validate']
are already arrays with content, so you should not be resetting them with array()
,$form['#action']
causes the form to do nothing when submitted,$form['#redirect']
in hook_form_alter()
will get overridden by other handlers, andhook_form_alter()
implementation would affect (and break) every form.More info: Forms API Reference
Instead, try the following:
function mymodule_form_alter(&$form, $form_state, $form_id) {
if ($form_id === 'form_id_goes_here') {
// Code here
$form['account']['pass'] = array(
'#type' => 'password_confirm',
'#size' => 25,
'#description' => t(''),
'#required' => TRUE
);
unset($form['Birthdate']['profile_birthdate']);
unset($form['Birthdate']);
$form['#validate'][] = '_mymodule_school_registration_validate';
$form['#submit'][] = '_mymodule_school_registration_submit';
}
}
function _mymodule_school_registration_submit($form, &$form_state) {
// Code here
$form_state['redirect'] = 'dir1/dir2/mypage';
}