2

I am completely new to Drupal. And I would really appreciate if someone could help me out here.

I used the "WebForm" module, and created a form. The data went into the database perfectly fine, as it appears under the results page.

Lets assume that this is a "Contact Us" form, that looks like this

Name: _______

Subject: ________

Message: ______

3 labels, 3 input fields. Easy enough.

I am trying to create a table for all users to see.

Name | Subject | Message

user1 | Hello | Thank you for helping me out

user2 | Goodbye | Drupal is great

If I were to use raw php, I would essentially be writing a SQL statement to Select all the data from the database, and use a For loop to generate these data into the table.

But how do I do this in Drupal? It seems impossible, and I cant seem to find 1 relevant documentation to generate this result.

Is there a webform extension that does this? Or am I expected to create a view to generate these data? If so, how?

Any help would be greatly appreciated.

3 Answers 3

2

He Hui,

Currently the webform module does not provide integration of its submissions data with the views module. You can see the status of this issue here: http://drupal.org/node/680386. There is plenty of interest and work on the issue, but it is not functionality that currently exists. By default, the only fields views will let you get to for the submissions are the sid, date created and a few others, but you can't get to the actual fields.

You can actually use additional modules to get to your webform submissions data in a round-about way, and there is lots of information online from folks who have made it work. For Drupal 7, here is a sample post with instructions: http://drupal.org/node/1658784. As you can see, you'll need three additional modules to get that functionality!

Hope this helps.

8
  • Hello Boriana, thanks for replying. Would you recommend that I write my own module to solve this problem? Or are there any other modules which I should refer to? I would have thought that this is a really basic function for most websites. Regarding webform_mysql_views, I did read up about it before posting. Apparently it is meant for Drupal 5, and is no longer maintained I believe?
    – He Hui
    Commented Aug 21, 2012 at 18:11
  • Hey there, I'd try the setup in that link I've provided first before writing your own module. It'd probably be a big undertaking otherwise. That module does have a Drupal 7 version. See here: drupal.org/project/webform_mysql_views Commented Aug 21, 2012 at 18:28
  • I have installed everything, and followed the instructions. It says that the view is generated, but I cant see it anywhere. I tried looking at the documentation for details on what should I expect to see, but there isnt anything. Do you have any idea?
    – He Hui
    Commented Aug 21, 2012 at 19:52
  • Yes, the documentation is definitely lacking and it's a complicated workaround. The view that's created is a MySQL view (it's a view in your database, not a Drupal view that you can work with yet). Make sure you keep following the instructions with Step 8 and beyond, which shows how to hook the data up to be usable with the Drupal views... Commented Aug 21, 2012 at 21:14
  • eh? I did not realise there is a step 8. Am i missing something here?
    – He Hui
    Commented Aug 21, 2012 at 21:22
0

When you have your webform in place the submissions will be shown under /node/YOUR-NODE-ID/webform-results. The table view you describe is a feature available under /node/YOUR-NODE-ID/webform-results/table.

You can also go to the node, click Results and then Table to view the same page.

1
  • Yes I am aware of this. But this is an administrator only feature? I want to customise these results, and put them into a table myself. I do not want to show all of these results to everyone; and also to rearrange them my way.
    – He Hui
    Commented Aug 21, 2012 at 15:43
0

You can make use of webform_get_submissions and retrieve all your submissions in your code and then subsequently make use of the hook_theme as shown in this comment to render out your table.

1
  • Just a note; if you are looking at a large number of submissions > 100K then there are liable to be some performance issues with this method. Your other option is to dump the values into a custom table and refresh the table with the values periodically or add the value using hook_webform_submission_insert. Redundant in terms of storage but will help performance.
    – Nishan
    Commented Sep 30, 2014 at 10:30

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.