Drupal Planet

Using Drupal Webform submission data

The Webform Drupal module is an amazing thing.  It lets you build all sorts of amazing forms.  Combined with jQuery you can construct dynamic forms that improve user quality of life.  However, Webform's export features are extremely limited.  You can get a run-of-the-mill exported CSV with every component includes with the generic field name.  What if you want or require a different format or a variable number of submissions only?  It seems like the only real solution right now is to write your own app or module that reads Webform's data.

Quickly upgrade Drupal core: only different files

Here's a handy commandline snippet that will help you upgrade Drupal core (for example, 6.19 to 6.20) without having to replace everything.  It will only update the files that have changed.

Redirect webform submissions to a dynamic URL in Drupal 6

If you need a way to redirect webform submissions to a dynamic URL in Drupal 6, using the Webform PHP module can work well with Webform 3.x.  I recommend only using post processing conditionals on select fields if possible with Webform PHP since you need to enable the permission to "use PHP for additional processing" for users who submit webforms (typically anonymous).

Here's the process:

JQuery Dropdown Menu Styling in Drupal

DrupalSN posted a nice guide to styling exposed View dropdown menus with a JQuery plugin and some stylish CSS.  The guide there worked perfectly except for the step where he hid the submit button.  I changed this:

.views-exposed-form label,
.jquery_dropdown_page .views-exposed-form .form-submit {
  display: none;

to this:

Using a nid argument in a block view in Drupal 6

I had a bit of an issue with this since I'm used to using arguments on view pages.  To use node id as an argument with a block view you cannot simple use the "Hide view / Page not found (404)" under "Action to take if argument is not present".  Instead, do the following:

  • Select "Provide default argument" under "Action to take if argument is not present"
  • Select "Node ID from URL"
  • Save your view and include your block on the targetted pages

This way you'll be able to pass the nid argument in your URL to the block view.  Whew!

CCK field as a view argument in Drupal 6

I found this trick during the development of Acton Institute's new Drupal-ized website.  I wanted to be able to list out other articles by the same author and show it on a sidebar.  Here's the setup:

  • Article authors are CCK nodereference fields to a separate author content type

How does one then construct a view that thinks the author is a CCK field and not the actual node's author?  It's a lot easier than I thought.  The only thing you need to have in your view is an argument with a little PHP magic.