Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4239244
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:00:34+00:00 2026-05-21T03:00:34+00:00

By default in Drupal 7, field descriptions appear below the field. Is there anyway

  • 0

By default in Drupal 7, field descriptions appear below the field. Is there anyway to move them above the field?

In Drupal 6, you could paste the following code in template.php to move the descriptions. However, the code does not work in Drupal 7:

/**
 * Place CCK Options above field .
 */

function ThemeNAME_form_element($element, $value) {
  $output  = ' <div class="form-item"';
  if(!empty($element['#id'])) {
    $output .= ' id="'. $element['#id'] .'-wrapper"';
  }  
  $output .= ">\n";
  $required = !empty($element['#required']) ? '<span class="form-required" title="'.t('This field is required.').'">*</span>' : '';

  if (!empty($element['#title'])) {
    $title = $element['#title'];
    if (!empty($element['#id'])) {
      $output .= ' <label for="'. $element['#id'] .'">'. t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) ."</label> \n";
    }
    else {
      $output .= ' <label>'. 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 .= " $value\n";
  $output .= " </div> \n";
  return $output;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T03:00:35+00:00Added an answer on May 21, 2026 at 3:00 am

    I had the same problem and accomplished this by adding it to my theme’s template.php file.

    /**
    * Replacement for theme_webform_element() to enable descriptions to come BEFORE the field to be filled out.
    */
    function danland_webform_element($variables) {
      $element = $variables['element'];
      $value = $variables['element']['#children'];
    
      $wrapper_classes = array(
        'form-item',
      );
      $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;
    }
    

    Don’t forget to clear your cache!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working in Drupal 6 with CCK. Under each text field there is a
By default the webjump hotlist has the following which I use quite often: M-x
I've got this image upload field in Drupal 7 with: '#default_value' => variable_get('default_img_fid', ''),
The default user registration page in Drupal 7 has fields to enter a username,
I have a Drupal 7 with 1 field added to registration form - a
I am using a drupal site.here is the code I have written in client
I am trying to set a default value for the location field of a
the default login form in drupal doesn't have any javascript to check whether the
I've got a hidden field inside a form, which I create using Drupal's form
I have a very simple question for all of you Drupal experts out there:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.