Closed (duplicate)
Project:
Webform
Version:
6.x-3.4
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Dec 2010 at 20:21 UTC
Updated:
18 Dec 2012 at 05:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
spelcheck commentedEdit: updated for use with webform 3.4.. see first commented line.
You'll need Views Custom Field for this.
This example creates a download link, but you could easily display the image via imagecache theme() functions, or simply print out an img tag to display the full image.
I'm sure there are better ways to do this, but this should be a good workaround for those of you who are under a time crunch. Note: the reason I'm not building anything in here to use multiple form nids is that the component id can (chances are, will) be different depending on the form.
elizzle
Comment #2
spelcheck commentedTo display an imagecache themed image, you might use this code instead of the download link.
elizzle
Comment #3
spelcheck commentedComment #4
spelcheck commentedIn order to actually filter by submissions that have a file uploaded in the field you're looking to get data from, you'll need to install Views PHP Filter and apply a patch to it to allow filtering based on webform submission ids instead of just the default node ids.
I patched against 2010-Nov-12 dev, and though the maintainer of viewsphpfilter will probably kill me, I've attached it. Once this module is installed, patch using the attached vpf-webform.patch so you get the 'Webform submissions: Webform SID PHP handler' filter available in your view.
In the body of that filter, place the following php code without the php tags:
Something to note: I couldn't find a way to extract the default argument of a view 'remotely' in php without actually executing the view, so the node_webform_submissions.nid and the webform_submitted_data.cid are both hardcoded. Other than that, it will work for the purpose.
This is obviously very processor intensive code, so I would really only use it for dev purposes and one-off reports.
elizzle
Comment #5
quicksketchI definitely won't be adding a PHP textarea to our Views integration. This feature request for getting an uploaded file's information should be handled in #680386: Views integration for the webform_submitted_data table.
Comment #6
SimpleDivya commentedI am requestiong you to please convert this code for drupal 7..?
Comment #7
samandrei commentedHi, elizzle
I got this error while follow your instruction on step #3 (create a 'Node: Nid' field and set it to the newly created 'Node' relationship.)
user warning: Unknown column 'node.webform_submission' in 'on clause' query: SELECT webform_submissions.sid AS sid, webform_submissions_node__node.nid AS webform_submissions_node__node_nid FROM webform_submissions webform_submissions LEFT JOIN node node ON webform_submissions.nid = node.nid INNER JOIN webform_submissions webform_submissions_node ON node.webform_submission = webform_submissions_node.nid LEFT JOIN node webform_submissions_node__node ON webform_submissions_node.nid = webform_submissions_node__node.nid LIMIT 0, 10 in /var/www/thisismysite.com/mymodule_dev/sites/all/modules/views/includes/view.inc on line 810.What I'm supposed to do? Please help & thanx b4.