Closed (fixed)
Project:
Webform
Version:
6.x-2.9
Component:
Documentation
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
5 Aug 2010 at 15:30 UTC
Updated:
7 Mar 2019 at 22:11 UTC
Jump to comment: Most recent
Hi there,
how could I add a custom submit handler to a webform? This don't work..
...
function mymodule_form_alter(&$form, $form_state, $form_id) {
if (!empty($_COOKIE['has_js']) && !empty($_GET['modalframe']) && in_array($form_id, array('webform-client-form-109'))) {
modalframe_child_js();
$form['#submit'][] = 'mymodule_form_mysubmit';
}
Comments
Comment #1
quicksketchYou need to add the submit handler to the actual submit button, not on the form.
Note that the "submit" button may be in a different location depending on which version of Webform you're using (2.x or 3.x).
Comment #2
Apfel007 commentedThanks it works!
Comment #3
quicksketchComment #5
msypes commentedIn case anyone hits this page, as I just did, 9 years later, in Drupal 7, which isn't long for the world either, it may be
$form['actions']['submit']['#submit'][] = 'mymodule_form_submit';.In Drupal 8, it's completely different, keep searching for something more relevant. ;)