We create simple Drupal Form through the Form API. The form is rendered but when we submit the form the get the same page back. Nothing happens from the _submit() function. Our form is as follows:
function contactus_form() {
$form = array();
$form['contactus'] = array(
'#type' => 'fieldset',
'#title' => t('KEEP ME INFORMED'),
'#tree' => TRUE,
);
$form['email_address'] = array(
'#type' => 'textfield',
'#title' => t('Email Address'),
'#size' => 30,
'#maxlength' => 64,
'#description' => t('Some Description Goes Here'),
);
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
return $form;
}
function contactus_form_submit($form_id, $form_values) {
drupal_set_message (t('We did stuff.'));
print 'We did stuff';
WriteToFile('C:\File.txt','We did stuff');
}
function contactus_page() {
$output = drupal_get_form('contactus_form');
print $output;
}
contactus_page();
We have confirmed that the data from the form is POSTING correctly but drupal is redirecting using a 302 Moved Teporarily, so drupal appears to be doing nothing with the data sent. Is there something that must be "turned on" to get this to work.