How to get drupal webform module submitted value programmatically?
I want to get the Webform submitted value using Webform modul开发者_开发技巧e API.
How can I do that?
I've got these link regarding webform hooks
Working with the Webform API (version 3.x only)
that contain these links
http://drupalcode.org/project/webform.git/blob/HEAD:/webform_hooks.php
http://api.lullabot.com/file/contrib/webform/webform_hooks.php
Custom coding: Adding advanced validation or submit code -
Investigate $form_state structure via print_r or dsm (devel module) and find your submitted data in mywebform_extra_submit_44
function.
Here is how I did it, the form was just an email address.
function mymodule_webform_submission_insert($node, $submission)
{
$value = array_shift($submission->data);
$value = array_shift($value['value']);
//$value is now the first value entered (in the case of multi-entry fields) or only value entered
}
Both node and submission are stdClass objects.
(Done in drupal 6)
精彩评论