There have been a couple threads about this (such as and I thought it worth requesting the change.

Right now the Description field is appearing after the Form Component field (eg textfield, etc...) when the webform is viewed. Since this is supposed to be help text for the Form Component field, can it be moved to appear between the Label and the Form Component field?

Description-text.png71.05 KBRedRock2512
Members fund testing for the Drupal project. Drupal Association Learn more


quicksketch’s picture

Version: 6.x-2.9 » 7.x-3.x-dev
Status: Active » Postponed

Webform does not have control over this theming, it uses the normal output as provided by Drupal core. The ONLY way we can change this is to provide entirely new theme functions for all form elements (which in Drupal core is around 8 or so). This isn't a practical task to accomplish, considering it'd be duplicating hundreds of lines of code. The good news however is that this limitation has been fixed in Drupal core, but we have to wait until Drupal 7 to take advantage of it. Since 3.x is maintained in sync between Drupal 6 and Drupal 7, we're probably looking at well over a year before this can be practically implemented, and it will never be implemented in Drupal 6.

That said, you can theme all form elements on your personal site just fine by overridding theme_form_element() within your theme.

pietro.a’s picture

Subscribing, for what it's worth.

paul.dambra’s picture

Version: 7.x-3.x-dev » 6.x-3.6

FWIW here's the code I used to "fix" this in Drupal 6. My theme is called bmc_zen replace that in the below as appropriate and add this to your theme's template.php

 * Replacement for theme_form_element().
function bmc_zen_form_element($element, $value) {
  $wrapper_classes = array(
  $output = '<div class="' . implode(' ', $wrapper_classes) . '" id="' . $element['#id'] . '-wrapper">' . "\n";
  $required = !empty($element['#required']) ? '<span class="form-required" title="' . t('This field is required.') . '">*</span>' : '';

  if (!empty($element['#title'])) {
    $title = $element['#title'];
    $output .= ' <label for="' . $element['#id'] . '">' . t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";

  if (!empty($element['#description'])) {
    $output .= ' <div class="description">' . $element['#description'] . "</div>\n";
  $output .= '<div id="' . $element['#id'] . '">' . $value . '</div>' . "\n";

  $output .= "</div>\n";

  return $output;

Obviously check your template.php for this function just in case :) Hope that helps someone.

quicksketch’s picture

Category: feature » support
Status: Postponed » Fixed

I should note that in Drupal 7 we do in fact have a separate theme function for webform form elements now: theme_webform_element(), which is exactly like theme_form_element() only it is specific to Webform fields, so you can move just the description of Webform elements now (in D7 only). As I said above, this unfortunately isn't possible in Drupal 6.

I'm going to go ahead and mark this fixed as a support request, since as a feature it's already as far as we'll take it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

baisong’s picture

I modified one line to suppress disabled component titles from being displayed:

if (!empty($element['#title'])) {

should be

if (!empty($element['#title']) && ($element['#title_display'] != 'none')) {

roblog’s picture

Thanks for the fix Paul - works a treat.

markosef’s picture

I am often surprised by lack of insight by module creators. There is so much top down approaches in drupal, so many divs and inner divs in theming and then you need to put a simple description in front of the field and you can't do it. What was developer of this module thinking? Like, ok, description has to be always after the field and that is it. If someone wants it before, they can make custom code. So why all the robustness when you fail at simple but often needed function? I just don't get it how can someone design something like that, really can somebody explain that?

dpedu’s picture

Issue summary: View changes

Sorry for the necromancy - but the above Drupal 7 solutions above break some features of webform conditionals.

For the most up-to-date way to do this, copy the function theme_webform_element in webform.module into your theme and copy the:

      if (!empty($element['#description'])) {
          $output .= ' <div class="description">' . $element['#description'] . "</div>\n";

Section up into the switch statement before the line where $element['#children'] is appended to $output.

But I agree with the other commenters - this would be a nice feature to have as part of webform.

jayhawkfan75’s picture

Thank you @dpedu for comment #9! That helped me out thoroughly.

modiphier’s picture


Trying this on a zen child theme in drupal 6 and its not doing anything. Any suggestions or a better solution to this issue yet?


DanChadwick’s picture

There is no support or development for the D6 branch, other than security issues. Maybe someone else can help you.

This is now a standard feature of the D7 branch though. Not that that helps you.