Written on November 6, 2008 at 6:30 am by Chase Sagum

Webform Field Types with Drupal

CMS one comment

I recently got an email with a very detailed question from Darius about the Weborm Module for Drupal and I wanted to post his question as well as my answer. I of course don’t profess to have all the answers when it comes to Drupal, as I am learning myself just like many of you are. But I hope my responses will help.

“Thank you so much for your helpful articles on chasesagum.com. Through google, I came upon your article on using webforms (http://chasesagum.com/how-to-use-webform-module-for-drupal) and thought that you might be able to answer my question about webform that’s been bugging me recently. (I hope you don’t mind.)

You see, I’m a Drupal (and PHP, I must say) newbie and I pretty much know how to use and manipulate the webform module from the user interface side. I’ve read the tutorials and watched the screencasts available out there. However, I still can’t figure out a solution to a simple problem (I believe) I’m having about webforms. –>

HOW DO I ADD NEW FIELDS TO WEBFORM, SIMILAR TO THOSE FOUND IN CCK?

As you of course know, the webform module currently allows only these fields:
• date
• fieldset
• file
• grid
• hidden
• markup
• pagebreak
• select
• textarea
• textfield
• time

But there are fields that are easily handled through CCK that possibly could also be included in webform:
• country (using a dropdown list)
• gender (also using a dropdown list… or “select” field as ‘M’ or ‘F’ radio buttons)
• etc…

I’m sure you get the idea. :-)

So… do you know of a way to get around this? I know this might involve creating my own PHP code, and there my problem lies– I’m a newbie to object-oriented PHP and just fairly familiar with procedural PHP (I’m just self-taught).

Thank you so much Chase for any insight, idea or any help you could give. More power to all your internet endeavors. :-)

My Answer

Here are 2 links to pages that explain I think what you are looking for. They explain how the Webform module is already built in with tools similar to CCK, but not to replace CCK so that you can create new fields like the ones you are needing.

http://drupal.org/handbook/modules/webform

http://drupal.org/node/325766

one response to " Webform Field Types with Drupal"

  1. Darius on November 6, 2008:

    Hi Chase,

    Thanks for taking the time to answer my question and to post it on your blog. :-) I’ll give your suggestions a try, and give you some feedback on the results. I hope it works.

Leave a comment

Get Adobe Flash playerPlugin by wpburn.com wordpress themes