Multigrid Webform Component

12 Jul 2011
Posted by jcfiala

(I originally wrote this for G+, but since it's long enough, I'm making it a blog post too.)

So, I'm making a new component for webform in Drupal, called 'Multigrid'. It's based on the grid component, which if you don't remember it, allows you to define a set of common options (like, neutral, dislike, hate beyond rational thought) and define a set of questions, and then it sets up a grid of radio buttons, where the answers are across the top and the questions go along the left side.

If you're picturing the online survey you filled out recently in the mistaken hope that you might win $500 after eating at sit-down-chain-restaurant-326, then that's pretty much it.

The new component is like this, but a little different. I need to, in addition to the user answering a question along a grade, also get an answer to a binary yes/no option. It's for a Scifi convention, MileHiCon, where participants say how much they like a given panel option, as well if they're interested in moderating it.

In a previous version of Webform I'd actually done this by creating two separate grids, and then used form_alter to combine the second yes/no grid into a checkbox in the first grid, but this had all sorts of problems. Happily it's now possible to create custom components much easier, and that's the way I'm going now.

I'll probably spin this into it's own module in a week or so, but I don't know if it's general enough that other folks would be interested in having access to it.

Tags: