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.
$form['#submit'][]
should work. Also try to add a validation handler and find out it is invoked -$form['#validate'][] = 'mymodule_newsletter_form_validaton';
mymodule_newsletter