Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#5 | 1647732-5--multiple_values.patch | 2.98 KB | drunken monkey |
Comments
Comment #1
AlfTheCat CreditAttribution: AlfTheCat commentedI'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.
Comment #2
Sarenc CreditAttribution: Sarenc commentedBut what if your text has commas?
Comment #3
AlfTheCat CreditAttribution: AlfTheCat commented@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.
Comment #4
drunken monkeyThe 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!
Comment #5
drunken monkeyOne little change: the overridden
query()
should of course only be active if the "Use Autocomplete" option is enabled.Comment #6
shabana.navas CreditAttribution: shabana.navas at Cheeky Monkey Media commented@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.
Comment #7
vasikei 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.