In a drupal 6 custom module I built, I have a menu callback which contains this:

function mymodule_register_confirmation() {
  return drupal_get_form('mymodule_newsletter_form');

I have the function that returns the form:

function mymodule_newsletter_form(&$form_state) {
  $form = array();

  $form['logo'] = array(
    '#type' => 'markup',
    '#value' => '<div class="logo-header">',


  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit')


  return $form;

I also built the function for the submit hook of newsletter form:

function mymodule_newsletter_form_submit($form, &$form_state) {
    die('I am in the submit hook!!');

The page shows as expected and contains the newsletter form exactly as I want. However, when I click the submit button, it goes to the action of the form (as expected) but the submit hook I built never executes. I even tried adding the following to the function that returns the form:

$form['submit']['#executes_submit_callback'] = TRUE;
$form['#submit'][] = 'mymodule_newsletter_form_submit';

What am I doing wrong?

Thanks in advance.

  • Are you clear the cache? Generally, $form['#submit'][] should work. Also try to add a validation handler and find out it is invoked - $form['#validate'][] = 'mymodule_newsletter_form_validaton';
    – Sithu
    Commented Nov 14, 2012 at 6:52
  • Is your module name is mymodule_newsletter Commented Nov 14, 2012 at 8:57
  • @SithuKyaw: added the validation handler it is not called either. Commented Nov 14, 2012 at 14:19
  • @SumitMadan: no, this test module is called "mymodule". Commented Nov 14, 2012 at 14:20
  • @RolandPish Please change the name mymodule_newsletter_form to mymodule_form and check. Commented Nov 15, 2012 at 4:46

2 Answers 2


Ahhhh, found the problem!

I had to specify manually a redirect to the form:

$form['#redirect'] = ''; // Redirects to the home page

This way the validate and submit hooks are called appropriately and then it redirects to the home page.

Thank you all for all your replies. I appreciate it.



Without the additional $form['#submit'][] = 'mymodule_newsletter_form_submit';, your code works just fine as is (pasted into a clean d6 install). There has to be something else going on that's preventing the submit handler from executing.

  • Mmm, interesting. I will have to dig in into the other custom modules to see if something is going on in there. Thanks a lot Sean! Commented Nov 14, 2012 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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