0
  • After somebody submits a webform, he should be redirected to the "webform result" (which is standard generated, but only accessible by clicking the "webform results" tab as an admin).
  • My module needs to hook into the "webform results", and add some simple custom PHP calculations on top of that "webform result" (for example: if two radio-elements have a certain value, a warning is displayed on top of that result page)

Any ideas ?

cheers

1 Answer 1

0

You have do some customization for this, use hook_form_alter().

  1. Create a custom module.
  2. Create a result page in that module.
  3. Alter the webform.
  4. Do the calculation.
  5. Sent the data to result page and show.

Example:

function  MODULE_NAME_form_alter(&$form, &$form_state, $form_id) {
  if (strpos($form_id, 'webform_client_form_') === 0) {
    // webform_client_form_ (change this id with your form id)

   $form['#submit'][] = 'changeform_form_submit';

  }
}

function changeform_form_submit($form, &$form_state) {
  ... your submission logic ...
}
1
  • 1) Hi. Would it be better that after submission, the user redirected to node/<nid>/submission/<sid>? Here is all the submitted content visible. 2) Is this a better hook to use : webform_submission_page() ? Then I can add custom PHP text to this variable : $output = drupal_get_form('webform_client_form_' . $node->nid, $node, $submission);
    – Summer
    Apr 28, 2017 at 16:04

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.