Index: webform.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.module,v
retrieving revision 1.196.2.3
diff -u -r1.196.2.3 webform.module
--- webform.module	11 Mar 2010 01:40:15 -0000	1.196.2.3
+++ webform.module	11 Mar 2010 04:34:03 -0000
@@ -1561,17 +1561,24 @@
   // Validate the current input.
   if (!isset($elements['#webform_validated']) || !$elements['#webform_validated']) {
     if (isset($elements['#needs_validation'])) {
+      // The hidetitle option should set the element label if it does not set
+      // the title so that the error message renders correctly.
+      $label = empty($elements['#label']) ? $elements['#title'] : $elements['#label'];
+      if (empty($label)) {
+        $label = isset($elements['#parents'][0]) ? $elements['#parents'][0] : '';
+      }
+
       // Make sure a value is passed when the field is required.
       // A simple call to empty() will not cut it here as some fields, like
       // checkboxes, can return a valid value of '0'. Instead, check the
       // length if it's a string, and the item count if it's an array.
       if ($elements['#required'] && (!count($elements['#value']) || (is_string($elements['#value']) && strlen(trim($elements['#value'])) == 0))) {
-        form_error($elements, t('!name field is required.', array('!name' => $elements['#title'])));
+        form_error($elements, t('!name field is required.', array('!name' => $label)));
       }
 
       // Verify that the value is not longer than #maxlength.
       if (isset($elements['#maxlength']) && drupal_strlen($elements['#value']) > $elements['#maxlength']) {
-        form_error($elements, t('!name cannot be longer than %max characters but is currently %length characters long.', array('!name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'], '%max' => $elements['#maxlength'], '%length' => drupal_strlen($elements['#value']))));
+        form_error($elements, t('!name cannot be longer than %max characters but is currently %length characters long.', array('!name' => $label, '%max' => $elements['#maxlength'], '%length' => drupal_strlen($elements['#value']))));
       }
 
       if (isset($elements['#options']) && isset($elements['#value'])) {
@@ -1586,13 +1593,13 @@
           foreach ($value as $v) {
             if (!isset($options[$v])) {
               form_error($elements, t('An illegal choice has been detected. Please contact the site administrator.'));
-              watchdog('form', 'Illegal choice %choice in !name element.', array('%choice' => $v, '!name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']), WATCHDOG_ERROR);
+              watchdog('form', 'Illegal choice %choice in !name element.', array('%choice' => $v, '!name' => $label), WATCHDOG_ERROR);
             }
           }
         }
         elseif (!isset($options[$elements['#value']])) {
           form_error($elements, t('An illegal choice has been detected. Please contact the site administrator.'));
-          watchdog('form', 'Illegal choice %choice in %name element.', array('%choice' => $elements['#value'], '%name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title']), WATCHDOG_ERROR);
+          watchdog('form', 'Illegal choice %choice in %name element.', array('%choice' => $elements['#value'], '%name' => $label), WATCHDOG_ERROR);
         }
       }
     }
@@ -1853,7 +1860,7 @@
           'submission' => $submission,
         );
         drupal_mail('webform', 'submission', $address, $language, $mail_params, $email['from']);
-  
+
         // Debugging output for email.
         if (variable_get('webform_debug', 0) >= 2) {
           drupal_set_message('E-mail Headers: <pre>' . check_plain(print_r($headers[$cid], TRUE)) . '</pre>To: ' . check_plain($address) . '<br />From: ' . check_plain($email['from']) . '<br />Subject: ' . check_plain($email['subject']) . '<br />E-mail Body: <pre>' . check_plain($email['message']) . '</pre>');
Index: components/select.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/components/select.inc,v
retrieving revision 1.39.2.4
diff -u -r1.39.2.4 select.inc
--- components/select.inc	11 Mar 2010 01:40:15 -0000	1.39.2.4
+++ components/select.inc	11 Mar 2010 04:34:03 -0000
@@ -23,6 +23,7 @@
       'multiple' => NULL,
       'aslist' => NULL,
       'optrand' => 0,
+      'hidetitle' => 0,
       'other_option' => NULL,
       'other_text' => t('Other...'),
       'description' => '',
@@ -95,6 +96,13 @@
     '#description' => t('If allowing other options, enter text to be used for other-enabling option.'),
     '#access' => module_exists('select_or_other'),
   );
+  $form['display']['hidetitle'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Hide the title'),
+    '#default_value' => $component['extra']['hidetitle'],
+    '#description' => t('This hides the title of the form component when they are displayed in the form.'),
+    '#parents' => array('extra', 'hidetitle'),
+  );
   $form['display']['optrand'] = array(
     '#type' => 'checkbox',
     '#title' => t('Randomize options'),
@@ -156,7 +164,8 @@
  */
 function _webform_render_select($component, $value = NULL, $filter = TRUE) {
   $element = array(
-    '#title'         => $component['name'],
+    '#title'         => $component['extra']['hidetitle'] ? NULL : $component['name'],
+    '#label'         => $component['name'],
     '#required'      => $component['mandatory'],
     '#weight'        => $component['weight'],
     '#description'   => $filter ? _webform_filter_descriptions($component['extra']['description']) : $component['extra']['description'],
