Index: modules/profile.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile.module,v
retrieving revision 1.126
diff -u -r1.126 profile.module
--- modules/profile.module	8 Jan 2006 12:06:13 -0000	1.126
+++ modules/profile.module	9 Jan 2006 14:58:08 -0000
@@ -369,7 +369,9 @@
         $fields[$category][$field->name] = array('#type' => 'checkbox', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#description' => _profile_form_explanation($field), '#required' => $field->required);
         break;
       case 'selection':
-        $options = array('--');
+        if (!$field->required) {
+          $options = array('--');
+        }
         $lines = split("[,\n\r]", $field->options);
         foreach ($lines as $line) {
           if ($line = trim($line)) {
@@ -479,6 +481,11 @@
   if ($edit['category'] == 'account') {
     form_set_error('category', t('The specified category name is reserved for use by Drupal.'));
   }
+
+  // Validation for a 'selection' field
+  if (($edit['type'] == 'selection') && $edit['required'] && !$edit['options']) {
+    form_set_error('options', t('You must enter selection options.'));
+  }
 }
 
 /**
@@ -568,6 +575,7 @@
 
 function _profile_field_form($type, $edit = array()) {
 
+  $form['type'] = array('#type' => 'hidden', '#value' => $type);
   $form['fields'] = array('#type' => 'fieldset', '#title' => t('Field settings'));
   $form['fields']['category'] = array('#type' => 'textfield', '#title' => t('Category'), '#default_value' => $edit['category'], '#description' => t('The category the new field should be part of.  Categories are used to group fields logically.  An example category is "Personal information".'));
   $form['fields']['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#description' => t('The title of the new field.  The title will be shown to the user.  An example title is "Favorite color".'));
