I have 4 webforms on a site and I would like to be able to display the data from each of those in a table using a view. Each of the forms has a "First Name" "Last Name" "Phone Number" and "Email Address" field, along with other fields that are specific to the different forms. Ideally, I would like to have a table that shows those 4 fields from all of the forms along with a column that says what form it came from. Can anyone give me an idea of where to start? My assumption is that the answer is somewhere in relationships and contextual filters, but I'm still learning how all of that stuff works. Any help or advice would be greatly appreciated. Thanks!!
-
1Are you looking to render the webforms with the input fields, or just the submissions?– chadpeppersJan 29, 2014 at 22:19
-
Just the submissions.– JamieJan 29, 2014 at 22:59
-
My understanding is that Webforms 4 is supposed to have some Views integration out of the box. I upgraded to version 7.x-4.0-beta3. When I create a field "Webform submission data: Value" and select the Webform and Field I want, it returns the value from all of the forms, not just the one I selected. Has anyone else had this issue?– JamieFeb 17, 2014 at 0:29
-
@chadpeppers how would you render the webforms with the input fields. ?– Aman DevrathFeb 19, 2020 at 12:17
2 Answers
Well after a couple of weeks I got it to work. In case anyone else wants to do the same, here is how I did it.
I added a Webform submissions: Data Relationship for each field in each form (16 total for me....4 fields from 4 webforms). Then I added the fields for each one (again 16 total). Then I went into the Table Settings and had each of the 4 types displayed in the same column. Then I just added a Content: Title field to show which Webform the submission came from.
I don't know if that is the best way to do it, but it worked for me.
Just stack into this and found one more solution:
- Create the view to show webform submissions
- Set its output format to Rendered Submissions | HTML
Ok, now we have all data from webform, but it looks not so good.
Create in your administration theme file webform-submission.tpl.php and theme it!
In my case it looks like this:
<?php
print 'Form name: '.$node->title.' <p><b>'.date('d.m.Y h:i', $submission->submitted).'</b></p>';
print drupal_render_children($renderable);
?>
You can output more data from $node, $submission and $renderable variables.