I have the following code:

function corporate_form_alter(&$form, &$form_state, $form_id) {

  switch ($form_id) {
    case 'user_login_block':

      $form['#action'] = '/user/login';
      $form['#submit'][] = 'custom_redirect';

      $form['actions']['submit2'] = array(
        '#type' => 'submit', 
        '#value' => t('Sign Up')

      //echo '<pre>';



By all examples I have seen this should call a custom_redirect() in which I have tried echo'ing and exiting and using drupal_set_message('Form submitted'); to verify this callback is called.

It is not...I have refreshed the cache a dozen times...I had this working about 3 weeks ago and changed something...

Any ideas?

  • I should note...I changed the index of the callbacks in the callback array to no effect either. Jul 23, 2013 at 18:40

1 Answer 1


All you need is $form['#submit'][] = 'custom_redirect';, if you want your custom submit handler to be ADDED to the default submit handlers.it will run along with the other (user module submit handlers) this way.

If you need this function only as your submit handler, then

$form['#submit'] = 'custom_redirect'; (assignment not addition to the submit array)

No need to alter the $form action.

Just alter the original submit button title if its necessary, no need to add another.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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