i seem to recall that the autocomplete widget that a nodereference field uses allows adding multiple selections. i think the somewhat odd ui for this was that you could select an item and then type a comma and start typing again and it would autocomplete on the part after the comma and allow you to add it.. basically creating a csv list of items.

would be cool if this module could also do this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AlfTheCat’s picture

Issue summary: View changes

I'm not sure about the original description, but I'm seconding the request to add support for selecting multiple values when using (text) fields (former CCK fields).

I'm really looking for a solution to have the same options for filtering views based on fields, as you have for filtering them on taxonomy terms.

So if you filter by a text field containing, let's say, countries, you'd only be able to filter on one country. It would be nice to be able to select multiple countries, just as if they were taxonomy terms.

Sarenc’s picture

But what if your text has commas?

AlfTheCat’s picture

@Sarenc,
Maybe integration with one or all of these?
https://www.drupal.org/project/autocomplete_deluxe
https://www.drupal.org/project/betterselect

Although I do think this module basically is valued most for filling the gap that is left open wide by the fact that you can only filter views intuitively when using (exposed) taxonomy terms. So this module I think would be most effective if it replicated that bahavior for fields.
I don't think having an exposed filter for long-text field (where one would expect commas) is an all too likely usecase. But still, the above modules have ways of dealing with that.

drunken monkey’s picture

Status: Active » Needs review
FileSize
2.84 KB

The attached patch works fine for me. It uses Drupal's built-in functionality for splitting the entered values (also used, e.g., for multi-valued taxonomy term reference fields) so values containing commas are also no problem.
Whether the different values are combined with AND or with OR depends on the filter group the filter is in – just click on the "And/Or, Rearrange" drop button next to "Filters" to make a new OR group for the filter, if necessary.

Anyways, would be great if something like this could be added to the module. Please take a look!

drunken monkey’s picture

FileSize
741 bytes
2.98 KB

One little change: the overridden query() should of course only be active if the "Use Autocomplete" option is enabled.

shabana.navas’s picture

@drunken_monkey, thanks! The patch was a life saver. Hoping it will be committed to the module soon, as it should be the norm behavior for all autocompletes.

vasike’s picture

Status: Needs review » Needs work

i couldn't make the last patch work - Views textfield filter doesn't know to filter multivalues.

What i think we need here
1. This shouldn't be default behaviour - add multiple values options for autocomplete
2. The query should know to group the multiple values into OR conditions.

So i think it needs more work.

@drunken monkey : am i missing something?

p.s. ofcourse thank you for the work on this one.