I want to control a particular webform submission event, and I am trying to use the following function in my template.php file.

function bartik_form_webform_client_form_7_submit(&$form, &$form_state) {}

The function is not working. How can I achieve this?

1 Answer 1


Try hook_form_alter() or hook_form_FORM_ID_alter(). This will help you to alter the array of the submission handlers and add a new submission handler.

function hook_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == 'Your-Webform-ID') {
    $form['#submit'][] = 'custom_settings_form_submit';

function custom_settings_form_submit($form, &$form_state) {
  // Your code here.

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.