I've looked at a number of posts, but none of them have quite the same issue as I am. I've added two custom submit buttons to a webform (in addition to the default one created by the admin page.) My custom validate function and submit function are being called, but the default submit function is not - i.e. the error logging I've put in my custom function gets printed, but the form is NOT actually submitted. Any ideas?
function create_vector_user_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'webform_client_form_24': // free trial webform
$form['submit']['64_bit_btn'] = array(
'#name' => 'op',
//'#button_type' => 'submit',
'#type' => 'submit',
'#value' => t('DOWNLOAD 64-BIT TRIAL'),
'#executes_submit_callback' => TRUE,
);
$form['#validate'][] = 'create_vector_user_free_trial_form_validate';
$form['#submit'][] = 'create_vector_user_free_trial_form_submit';
$form['actions']['submit']['#submit'][] = 'create_vector_user_free_trial_form_submit';
break;
}
}
function create_vector_user_free_trial_form_validate($form, &$form_state) {
// this function runs correctly
}
function create_vector_user_free_trial_form_submit($form_id, &$form_state) {
error_log("submit!");
if (strtoupper($form_state['clicked_button']['#value']) == 'DOWNLOAD 64-BIT TRIAL') {
error_log("submitted 64");
}
else if(strtoupper($form_state['clicked_button']['#value']) == 'EMAIL ME A LINK') {
error_log("submitted email");
$to = $form_state['values']['submitted']['email'];
$params = array();
$params['version'] = $form_state['values']['submitted']['download_type'];
$key = 'homepage';
drupal_mail('create_vector_user', $key, $to, language_default(), $params);
}
else {
error_log("submitted default 32");
}
error_log("test end");
}
ETA: I've also tried this in my form_alter
function based on this article about custom validation:
$form['#validate'][] = 'create_vector_user_free_trial_form_validate';
// $form['#submit'][] = 'create_vector_user_free_trial_form_submit';
$first = array_shift($form['#submit']);
array_unshift($form['#submit'], $first,'create_vector_user_free_trial_form_submit');
//$form['actions']['submit']['#submit'][] = 'create_vector_user_free_trial_form_submit';