summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-04-22 09:12:44 +0000
committerDries Buytaert <dries@buytaert.net>2009-04-22 09:12:44 +0000
commit2bc19555bfca04551333e361509c2f51841e16c2 (patch)
tree2548445f39fe4e4ffc0910d4446f8c3fdaf46093 /includes
parent920babfe6ea1c929d7df16631e4de52f0646e518 (diff)
downloadbrdo-2bc19555bfca04551333e361509c2f51841e16c2.tar.gz
brdo-2bc19555bfca04551333e361509c2f51841e16c2.tar.bz2
- Patch #302240 by fago: fixed various problems with form storage and added tests. Yay.
Diffstat (limited to 'includes')
-rw-r--r--includes/form.inc21
1 files changed, 10 insertions, 11 deletions
diff --git a/includes/form.inc b/includes/form.inc
index 5058ffdf2..366c6a115 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -188,9 +188,8 @@ function drupal_build_form($form_id, &$form_state) {
if ($cacheable && !empty($form['#cache']) && empty($form['#no_cache'])) {
// Caching is done past drupal_process_form so #process callbacks can
- // set #cache. By not sending the form state, we avoid storing
- // $form_state['storage'].
- form_set_cache($form_build_id, $original_form, NULL);
+ // set #cache.
+ form_set_cache($form_build_id, $original_form, $form_state);
}
}
@@ -201,14 +200,14 @@ function drupal_build_form($form_id, &$form_state) {
// the form will simply be re-rendered with the values still in its
// fields.
//
- // If $form_state['storage'] or $form_state['rebuild'] have been
- // set by any submit or validate handlers, however, we know that
- // we're in a complex multi-part process of some sort and the form's
- // workflow is NOT complete. We need to construct a fresh copy of
- // the form, passing in the latest $form_state in addition to any
- // other variables passed into drupal_get_form().
-
- if (!empty($form_state['rebuild']) || !empty($form_state['storage'])) {
+ // If $form_state['storage'] or $form_state['rebuild'] has been set
+ // and the form has been submitted, we know that we're in a complex
+ // multi-part process of some sort and the form's workflow is NOT
+ // complete. We need to construct a fresh copy of the form, passing
+ // in the latest $form_state in addition to any other variables passed
+ // into drupal_get_form().
+
+ if ((!empty($form_state['storage']) || !empty($form_state['rebuild'])) && !empty($form_state['submitted']) && !form_get_errors()) {
$form = drupal_rebuild_form($form_id, $form_state);
}