Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.265.2.2
diff -u -r1.265.2.2 form.inc
--- includes/form.inc	7 Feb 2008 18:53:37 -0000	1.265.2.2
+++ includes/form.inc	7 Feb 2008 19:02:52 -0000
@@ -924,13 +924,14 @@
   }
 
   // If some callback set #cache, we need to flip a static flag so later it
-  // can be found.
-  if (isset($form['#cache'])) {
-    $cache = $form['#cache'];
+  // can be found, but only if previous elements didn't requested the
+  // form to be non cacheable.
+  if (isset($form['#cache']) && (!isset($cache) || $cache)) {
+      $cache = $form['#cache'];
   }
   // We are on the top form, we can copy back #cache if it's set.
   if (isset($form['#type']) && $form['#type'] == 'form' && isset($cache)) {
-    $form['#cache'] = TRUE;
+    $form['#cache'] = $cache;
   }
   return $form;
 }
