You are here

function webform_form_submit in Webform 5.2

Same name and namespace in other branches
  1. 6.3 webform.module \webform_form_submit()
  2. 6.2 webform.module \webform_form_submit()
  3. 7.4 webform.module \webform_form_submit()
  4. 7.3 webform.module \webform_form_submit()

Submit handler for the webform node form.

Redirect the user to the components form on new node inserts. Note that this fires after the hook_submit() function above.

File

./webform.module, line 879

Code

function webform_form_submit($form_id, $form_values) {

  // There should be a more effective way to find the new node ID.
  $nid = db_result(db_query_range("SELECT nid FROM {node} WHERE type = 'webform' ORDER BY nid DESC", 0, 1));

  // Remove the submitted message added by node module.
  unset($_SESSION['messages']['status']);
  drupal_set_message(t('The new webform %title has been created. Add new fields to your webform with the form below.', array(
    '%title' => $form_values['title'],
  )));
  if (!$form_values['status']) {
    drupal_set_message(t('This webform is currently unpublished. After finishing your changes to the webform, use the <em>Publish</em> button below.'));
  }
  return 'node/' . $nid . '/edit/components';
}