Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// Connect Webform with some other module / system / action
// 1. Implement form_alter and add a submit handler to the webform client form
function yourmodule_form_alter(&$form, &$form_state, &$form_id) {
if(substr($form_id, 0, 20) == 'webform_client_form_') {
$form['#submit'][] = 'yourmodule_subscribe_from_webform';
// 2. In the submit handler, use the values and do any action needed
function yourmodule_subscribe_from_webform(&$form, &$form_state) {
// On submit, you get the webform submitted values
$values = $form_state['values']['submitted'];
// The values will be keyed by component ID (IIRC), you can check the ids in the
// webform_component database table, and with a bit of SQL work,
// you can get the cid for a given form_key
// Now that you have the values you can: perform some HTTP request to save
// data in a remote server, db query, call a function or whatever you need
// to do to subscribe your user to the newsletter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.