Closed (fixed)
Project:
Webform
Version:
6.x-2.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
29 Apr 2008 at 14:49 UTC
Updated:
4 Mar 2011 at 09:12 UTC
Hi,
Since the submission Webform content is stored in a database, is it possible to use the information submitted in the database in a node?
If so, does anyone have ideas on how that might be done?
Thanks!
Comments
Comment #1
quicksketchYou can pull data out of webform by using the PHP function webform_get_submission(). However, if you're asking if a webform submission can be a node, absolutely not (there's a note about this on the project homepage).
Comment #2
martenw commentedThanks quicksketch! Yeah, I saw that note too, that was not what i was going for...i could probably use webform_get_submission().
Now all i have to do is learn how to use it properly. If anyone thinks it sounds like fun to post a code snippet example, i would be most grateful!
Until then, i'll just keep trying!
Comment #3
martenw commentedLet me correct that: I will not keep trying! too little knowledge, too little patience!
So let me instead put it this way: Suppose i have a webform with a textfield called "name". What code would i have to put into a page node in order for it to show the data in "name".
Thanks in advance for any help, it's much appreciated!
Comment #4
quicksketchSomething like this (totally, totally untested):
Comment #5
martenw commentedIf if could send you flowers...
Even if it's untested, now i have something to work with! Thank you so much!
Comment #6
martenw commentedI got a white screen with this message:
Fatal error: Call to undefined function webform_get_submission()
Since it looked like webform_get_submission() was defined in "webform_submissions.inc", i tried adding this to the code:
But then i got this message instead:
Fatal error: Cannot redeclare webform_menu_submission_load()
Any suggestions?
Comment #7
quicksketchI'm not able to provide further help on this issue. As no one has posted in several months, I'm closing the issue.
Comment #8
saml commentedmartenw, (message #6)
I managed to load webform submissions. I did it in the webform-confirmation.tpl.php, (which is used to create custom confirmation messages) so I had access to the variable $sid (submission id) and $node->nid which is automatically the nid of the actual webform, since I'm staying at that node when writing out the confirmation message. But I guess the method works quite generally, except for that you'll need to get the sid and nid values somehow.
I loaded the submitted data using the following code:
Hint for non php-developers: Use the following code to see how to retreive the data you're interested in:
(More hints for non php-devs): $temp_submission, when using the first line of code above, will be an object, not an array, so the first level of elements that you see in the tree outputted by print_r is variables in that object, and are accessible with the "->" syntax. For example, I retreived the content of an e-mail field (which was field no 2 in my form) like so:
Comment #9
summit commentedHi,
WOuld be great to be able to get some of the info from the webform submission inside say a weblinks node.
Subscribing, while this thread is leading to something right?
greetings,
Martijn
Comment #10
nnevillbefore using webform_get_submissions()
you need to include:
include_once(drupal_get_path('module', 'webform') ."/includes/webform.submissions.inc");it's for 3rd version, biu i think for 2nd it must be similar