summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Wehner2012-12-23 10:28:34 (GMT)
committer Daniel Wehner2012-12-23 10:28:34 (GMT)
commit7173513ff4176d453bc856d2423104a25430ebe5 (patch)
tree5cb61e64a642fe69df5f740a96d8eaae3f3b9b65
parentf7cb51aad6943973e22197d54d202453292d6a27 (diff)
Issue #1863020 by amarnus: Fixed View's build fails when an unrelated form on the same page has validation errors.
-rw-r--r--includes/view.inc10
1 files changed, 9 insertions, 1 deletions
diff --git a/includes/view.inc b/includes/view.inc
index d948b64..4fd0afd 100644
--- a/includes/view.inc
+++ b/includes/view.inc
@@ -960,8 +960,16 @@ class view extends views_db_object {
if ($this->display_handler->uses_exposed()) {
$exposed_form = $this->display_handler->get_plugin('exposed_form');
+ // (1) Record the errors before rendering the exposed form widgets
+ $errors_before = form_set_error();
$this->exposed_widgets = $exposed_form->render_exposed_form();
- if (form_set_error() || !empty($this->build_info['abort'])) {
+ // (2) Record the errors after rendering the exposed form widgets
+ $errors_after = form_set_error();
+ // Find out if the validation of any of the elements in the exposed form
+ // has failed by comparing (1) and (2) above. Don't mess with the view
+ // otherwise.
+ $exposed_errors = count($errors_after) > count($errors_before);
+ if ($exposed_errors || !empty($this->build_info['abort'])) {
$this->built = TRUE;
// Don't execute the query, but rendering will still be executed to display the empty text.
$this->executed = TRUE;