I need two exposed filters in view.
One is node title with autocomplete
Another is CCK field where Allowed values are set and therefor I can use it as select list. But when this filter is exposed then autocomplete retrieves no values. However - when this filter is removed or not exposed, everything works fine.

Thank You!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vipin.mytechplay’s picture

I also find the same issue. I have two different types of nodes and a view with two displays (each display is meant for particular node). Each display exposes node title as view filter.
When auto-complete is enabled on both exposed filters then one stops working and other starts showing nodes of both node types. However, if I disable one filter things do work fine.

regards,
Vipin

vasike’s picture

Status: Active » Postponed (maintainer needs more info)

1. This module doesn't work with cck with allowed values,
- http://drupal.org/node/1157370 , http://drupal.org/node/1151218

2. I see this is a version 2 of the module. This should not be used.
please try with 6.x-1 versions
http://drupal.org/node/1130370
http://drupal.org/node/1102386

vipin.mytechplay’s picture

vasike,

In my case, comment 1, both fields are node titles and none of this title is present in default display of the view then why the problem is coming. I am using 6.x-1.2 version of the module.

Vipin

hsimeoni’s picture

Version: 6.x-2.x-dev » 6.x-1.2
Assigned: Unassigned » hsimeoni

Same here

It doesn't work with multiple exposed filters

MBroberg’s picture

Are the filters named the same thing? I have issues with filter identifier names. Be sure to make them unique and not "name" or "value" as those have given me trouble.

liquidcms’s picture

can't get autocomplete to list anything other than the note that says field needs to exist in fields list (which it does).

setup is a noderef field which i have created a relationship from so that i can use node title as both the field to display and the filed to filter.

have tried 2.x-dev, 1.2

would be a very cool module if i could get it to work.

tuzoo’s picture

same for me...
the fields that are displayed on the page are correctly filtered, but the fields in the autocomplete-list are not, if the second field is also exposed. if the second field isn't exposed, the filters are applied to both outputs.

I have tried now all kinds of combinations...this is were I'm right now:

display:page

fields: (overridden)
content: testfield
node: title

filters: (overridden)
this works:
content: testfield (hidden, is equal to = test)
node: title ( exposed, op = contains, optional, auto-complete)

this doesn't works:
content: testfield ( exposed, op = contains, optional)
node: title ( exposed, op = contains, optional, auto-complete)

I would really appreciate help or tipps.

thanks ;)

heydemo’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
1.08 KB

Attached a patch that fixes this issue. Basically removes other exposed filters so that the autocomplete is not limited by these exposed filters which it doesn't yet have data for.

MtnMn’s picture

I'm trying to get this to work. I think my problem is with the last part of the patch.

@@ -58,4 +69,4 @@
$matches[''] = '

'. t('The %string return no results. Please try something else.', array('%string' => $string)) . '

';
}
drupal_json($matches);
-}
\ No newline at end of file
+}

What exactly am I doing? removing } then adding it again?

Thank you for your help

drm’s picture

I've got 3 exposed filters, two of which are auto-completes. One of those is a title, the other a CCK field.

The autocomplete for the CCK field appears to be returning (the dropdown list) the node ids instead of cck field values. Node title works fine.

jerry’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #8 worked for me.

jvieille’s picture

Issue summary: View changes

I found the problem.
The worse you would get is then you are using several fields / filters of the same type. You will likely get xxx_1/2/3 fields and filter system IDs that do not match at all, except if you carefully implement them in the exactly same order.

The code made provision for this by trying to match the correct field based on the filter custom id instead of the filter system id, but it did it wrongly. Below the correct code

function views_autocomplete_filter($field_name = NULL, $view_name, $view_display, $arguments, $string = '') {
....
 $field_filter = $currentview->handler->options['filters'][$field_name];
 // assign string value to the exposed text filter
 $view->exposed_input[$field_filter['expose']['identifier']] = $string;
 +$filter_id = $field_filter['expose']['identifier'];
 -$item = $view->get_item($view_display, 'filter', $field_name);
 +$item = $view->get_item($view_display, 'filter', $filter_id);
 // overwrite the fields for the view
 -$view->display[$view_display]->handler->options['fields'] = array($field_name => $item);
 +$view->display[$view_display]->handler->options['fields'] = array($filter_id => $item);
 -$view->display[$view_display]->display_options['fields'] = array($field_name => $item);
 +$view->display[$view_display]->display_options['fields'] = array($filter_id => $item);
 $view->execute($view->current_display);
 $currentview = $view->display[$view_display];
 // views field handler data
 -$field = $currentview->handler->handlers['field'][$field_name];
 +$field = $currentview->handler->handlers['field'][$filter_id];
 $field_alias = $field->field_alias;

 foreach ($view->result as $id => $row) {
   // Add a class wrapper for a few required CSS overrides.
...
colan’s picture

Status: Reviewed & tested by the community » Closed (outdated)