=== modified file 'modules/field/modules/list/list.module'
--- modules/field/modules/list/list.module	2010-09-04 15:40:51 +0000
+++ modules/field/modules/list/list.module	2010-10-10 07:23:20 +0000
@@ -84,9 +84,8 @@ function list_field_settings_form($field
     $off_value = array_shift($values);
     $on_value = array_shift($values);
     $form['allowed_values'] = array(
-      '#type' => 'markup',
+      '#type' => 'value',
       '#description' => '',
-      '#input' => TRUE,
       '#value_callback' => 'list_boolean_allowed_values_callback',
       '#access' => empty($settings['allowed_values_function']),
     );
@@ -96,6 +95,9 @@ function list_field_settings_form($field
       '#default_value' => $on_value,
       '#required' => FALSE,
       '#description' => t('If left empty, "1" will be used.'),
+      // Change #parents to make sure the element is not saved into field
+      // settings.
+      '#parents' => array('on'),
     );
     $form['allowed_values']['off'] = array(
       '#type' => 'textfield',
@@ -103,7 +105,14 @@ function list_field_settings_form($field
       '#default_value' => $off_value,
       '#required' => FALSE,
       '#description' => t('If left empty, "0" will be used.'),
+      // Change #parents to make sure the element is not saved into field
+      // settings.
+      '#parents' => array('off'),
     );
+    // Link the allowed value to the on / off elements to prepare for the rare
+    // case of an alter changing #parents.
+    $form['allowed_values']['#on_parents'] = &$form['allowed_values']['on']['#parents'];
+    $form['allowed_values']['#off_parents'] = &$form['allowed_values']['off']['#parents'];
   }
 
   // Alter the description for allowed values depending on the widget type.
@@ -156,12 +165,13 @@ function list_allowed_values_setting_val
 /**
 * Form element #value_callback: assembles the allowed values for 'boolean' fields.
 */
-function list_boolean_allowed_values_callback($element, $edit = FALSE) {
-  if ($edit !== FALSE) {
-    $on = $edit['on'];
-    $off = $edit['off'];
-    $edit = "0|$off\n1|$on";
-    return $edit;
+function list_boolean_allowed_values_callback($element, $input, $form_state) {
+  // This is part of a multistep form and when the form is displayed, the
+  // allowed_values, on and off form elements do not yet exist.
+  if ($input !== FALSE) {
+    $on = drupal_array_get_nested_value($form_state['input'], $element['#on_parents']);
+    $off = drupal_array_get_nested_value($form_state['input'], $element['#off_parents']);
+    return "0|$off\n1|$on";
   }
 }
 

=== modified file 'modules/field/modules/list/tests/list.test'
--- modules/field/modules/list/tests/list.test	2010-08-05 23:53:37 +0000
+++ modules/field/modules/list/tests/list.test	2010-10-10 07:36:53 +0000
@@ -134,26 +134,40 @@ class ListFieldUITestCase extends FieldT
   function testAllowedValues() {
     $element_name = "field[settings][allowed_values]";
 
-    //Test 'List' field type.
+    // Test 'List' field type.
     $admin_path = $this->createListFieldAndEdit('list');
-    //Check that non-integer keys are rejected.
+    // Check that non-integer keys are rejected.
     $edit = array($element_name => "1.1|one\n");
     $this->drupalPost($admin_path, $edit, t('Save settings'));
     $this->assertText("keys must be integers", t('Form validation failed.'));
 
     // Test 'List (number)' field type.
     $admin_path = $this->createListFieldAndEdit('list_number');
-    //Check that non-numeric keys are rejected.
+    // Check that non-numeric keys are rejected.
     $edit = array($element_name => "1|one\nB|two");
     $this->drupalPost($admin_path, $edit, t('Save settings'));
     $this->assertText("each key must be a valid integer or decimal", t('Form validation failed.'));
 
-    //Test 'List (text)' field type.
+    // Test 'List (text)' field type.
     $admin_path = $this->createListFieldAndEdit('list_text');
-    //Check that over long keys are rejected.
+    // Check that over long keys are rejected.
     $edit = array($element_name => "1|one\n" . $this->randomName(256) . "|two");
     $this->drupalPost($admin_path, $edit, t('Save settings'));
     $this->assertText("each key must be a string at most 255 characters long", t('Form validation failed.'));
+
+    // Test 'Boolean' field type.
+    $admin_path = $this->createListFieldAndEdit('list_boolean');
+    // Check that the seperate 'On' and 'Off' form fields work.
+    $edit = array(
+      'on' => $this->randomName(),
+      'off' => $this->randomName(),
+    );
+    $this->drupalPost($admin_path, $edit, t('Save settings'));
+    $this->assertText("Saved test_list_boolean configuration.", t("The 'On' and 'Off' form fields work for boolean fields."));
+    // Test the allowed_values on the field settings form.
+    $this->drupalGet($admin_path);
+    $this->assertFieldByName('on', $edit['on'], t("The 'On' value is stored correctly."));
+    $this->assertFieldByName('off', $edit['off'], t("The 'Off' value is stored correctly."));
   }
 
   /**
@@ -182,4 +196,3 @@ class ListFieldUITestCase extends FieldT
   }
 
 }
-

