Support from Acquia helps fund testing for Drupal Acquia logo

Comments

digibrill’s picture

Same here - subscribing

_grizly’s picture

Issue summary: View changes

I was getting this as well, my hook_form_views_exposed_form_alter function was removing empty filters from the form, so the url parameters weren't there for processing. To prevent the error I slightly patched the views handler (It doesn't appear to have broken any of my dozens of other views):

views/handlers/views_handler_filter.inc line 1273
from:

      $value = $input[$this->options['expose']['identifier']];

to:

      $value = @$input[$this->options['expose']['identifier']];
      if(!$value)
          $value = 'All';

Initially it appeared as a "boost" issue, the sheer volume of "selective filters" in the view was making the urls too long for the filesystem to save a "boost" copy. And bots crawling my site was making it lag with the infinite variations in so many input filters.

How many &a=All&b=All&c=All's do you need before your "Clean Urls" become ugly again?

alansaviolobo’s picture

I have a view with exposed filters.
when I visit the page for the first time, I get these warnings ( as the url does not have those params )

I dont have any custom code that touches the urls. not sure why this is happening. but the hack provided worked for me.

derekrezek’s picture

i am getting the following notice on the views edit page:

  1. Notice: Undefined index: l12agno in accept_exposed_input() (line 1273 of C:\xampp\htdocs\drupal7\sites\all\modules\views\handlers\views_handler_filter.inc).
  2. Notice: Undefined property: views_display::$handler in execute() (line 1134 of C:\xampp\htdocs\drupal7\sites\all\modules\views\includes\view.inc).

i have added a filter on a taxonomy term for which i have written a custom filter handler (by using _views_data_alter):

$data['taxonomy_term_data']['l12agno'] = array(
    'title' => t('L1/2 Agnostic'),
    'help' => t('Lx Agnostic filter'),
    'real field' => 'tid',
    'filter' => array(
      'handler' => 'views_handler_filter_lx_agnostic',
    ),
  );

the custom handler looks like this:
here "categoryta" is a 3 level hierarchy.


class views_handler_filter_lx_agnostic extends views_handler_filter {
  
  function value_form(&$form, &$form_state) {
    parent::value_form($form, $form_state);
    if (!empty($form_state['exposed'])) {
      $form['value'] = array(
        '#type' => 'container',
        '#prefix' => '<div id="views_category_wrapper" class="clear-block container-inline">',
        '#suffix' => '</div>',
        '#tree' => TRUE,
      );
      $vocab = taxonomy_vocabulary_get_names();
      $tree = taxonomy_get_tree($vocab['categoryta']->vid, 0, NULL, TRUE);
      $options = array();
      foreach ($tree as $item) {
        if(!$item->deleted) {
          $options[$item->parents[0]][$item->tid] = $item->name;
        }
      }
      $form['value']['t0'] = array(
        '#type' => 'select',
        '#options' => isset($options[0])? $options[0] : array(),
        '#empty_value' => 0,
        '#empty_option' => t('All'),
        '#default_value' => 0,
      );
      if (isset($options[0])) {
        foreach ($options[0] as $tid => $title) {
          $form['value']['t' . $tid] = array(
            '#type' => 'select',
            '#options' => $options[$tid],
            '#empty_value' => 0,
            '#empty_option' => t('All'),
            '#default_value' => 0,
            '#states' => array(
              'visible' => array(
                ':input[name="l12agno[t0]"]' => array(
                  'visible' => TRUE,
                  'value' => $tid,
                )
              )
            )
          );
        }
      }
    }
  }

  function query() {
    $this->ensure_my_table();
    if (!empty($this->value[0]['t0'])) {
      $t0 = 't' . $this->value[0]['t0'];
      if(!empty($this->value[0][$t0])) {
        $field = "$this->table_alias.$this->real_field";
        $this->query->add_where($this->options['group'], $field, $this->value[0][$t0], '=');
      }
      else {
        $def = $this->definition;
        $def['table'] = 'taxonomy_term_hierarchy';
        if (!empty($this->table_alias)) {
          $def['left_table'] = $this->table_alias;
        }
        else {
          $def['left_table'] = $this->table;
        }
        $def['left_field'] = $this->real_field;
        $def['field'] = 'tid';

        $join = new views_join();

        $join->definition = $def;
        $join->construct();
        $join->adjusted = TRUE;

        // use a short alias for this:
        $alias = $def['table'] . '_' . $this->table;

        $this->alias = $this->query->add_relationship($alias, $join, $alias . '_' . $this->real_field, $this->relationship);
        $this->query->add_where($this->options['group'], "$this->alias.parent", $this->value[0]['t0'], '=');
      }
    }
  }

  public function operators() {
    return array();
  }
}

The same code is working on production, but not in my local system.
I have tried flushing cache and trying different browsers and switching between different jquery_update versions.
Any help is appreciated.

derekrezek’s picture

i checked for the path entry for the class: views_handler_filter_lx_agnostic in registry table, and it was missing.

devad’s picture

I had similar errors in some of my views after I have updated views module to most recent version recently.

Re-saving views and their problematic exposed filters (you can recognize them by "undefined index" value) helped me to fix the issue.

rexfordnyrk’s picture

Hello guys, I seem to have been having this same problem with the undefined index thingy after updating to the recent version. all my views worked perfectly without any such problems. but after update BOOMThe error!! anytime I try ti edit the that specific display the browser hangs executing ajax script, sometimes freezing the entire computer. but when I stop the script then the error shows and my computer comes back to normal.

Ok so I just went back to downgrade my views module to version 7.x-3.17 and it works

Dan_i_am’s picture

This problem started recently for me with 7.x-3.20. Re-saving the effected filter and the view didn't fix the issue in my case. The error message produced is

Notice: Undefined index: field_guide_status_value in views_handler_filter->store_exposed_input() (line 1395 of /var/www/html/stagegearank/sites/all/modules/views/handlers/views_handler_filter.inc).

The effected field is a multi-select box if that helps. Let me know if this should be created as a new issue.

martinhansen’s picture

sano’s picture

Version: 7.x-3.8 » 7.x-3.20
roderik’s picture

Status: Active » Needs review
FileSize
1.1 KB

I don't think this is related to any specific views version, and I'm not sure this is related to any of the referenced issues.

In my case, for whatever reason, one of the filter handlers was broken - and I suspect all responders from #4 until here had a similar issue. This may or may not be solved by re-saving the view; it depends on how broken the filter handler is, and why.

This issue cannot be solved by a patch. But we might help things by

  • making sure no message is displayed on the web page. (This could be counter productive depending on your way of working because it could 'hide' things from you as an admin, but we should probably default to not displaying strange messages.)
  • logging a message to watchdog instead to give a hint that the view is broken (even though it's probably working up to a point), which you will hopefully spot at some point.

It will then be up to you to actually check the view and see what's wrong.

Note this will not solve the issues encountered 5 years ago by

  • _grizly, because doing that the right way is a much bigger issue
  • alansaviolobo; I don't know what's going on there because accept_exposed_input() should not be called when visiting the page for the first time.
roderik’s picture

Version: 7.x-3.20 » 7.x-3.x-dev