I'm using the module to autocomplete from existing field data, using a 'contains' search. At the moment, I have four unique field entries:

Artist D 100% (ASCAP)
Artist D 50% (ASCAP)
Artist J 100% (ASCAP)
Artist J 50% (ASCAP)

If I type "5" I get both Artist D 50% (ASCAP) and Artist J 50% (ASCAP). However, "J" gives me Artist J 100% (ASCAP), "D" gives me Artist D 100% (ASCAP) -- neither one with the 50% option.

#7 1430418.patch454 bytesbleen
Members fund testing for the Drupal project. Drupal Association Learn more


bleen’s picture

can you export your content type and post the result. So far I am unable to reproduce

mrtoner’s picture

I'm not sure how to export a content type?

bleen’s picture

Status: Active » Closed (cannot reproduce)

I have spent some time this morning on this with another developer at Drupalcon and we simply cannot reproduce. The only possible cause we came up with is that perhaps you chose "case-sensitive" when setting up the widget and the actual data you have is not the same case.

So, unless you can give me reproducible steps I'm going to close this issue.

mrtoner’s picture

Status: Closed (cannot reproduce) » Active

I dug into this a bit tonight, figured out the query you're building and found that you can easily reproduce this:

1. Create a field with an autocomplete widget, using existing field values, and assign it to a content type.
2. Create 10 nodes of that content type. For each of the fields with the autocomplete widget, give it a value of "John Smith".
3. Create an 11th node, with a field value of "John Carter".
4. Create node #12 -- type "j" in the field. "John Carter" will not show as a possible option.

The problem is here:

$options = _autocomplete_widgets_get_options($field, $string, $match, NULL, 10);

You're attempting to limit the number of options to 10, but what is actually happening is that you've limited the number of records returned by the query to 10 -- the first 10. Instead, you need to return all possible values from the db, reduce those to only unique values, and then reduce those to 10.

bleen’s picture

That's a different scenario than the one in your original post ... I was only testing with 4 elements.

I'll take a closer look at this.

mrtoner’s picture

Sorry, I wasn't clear (as I realized when I last posted): that was four unique values, with 200+ total entries.

bleen’s picture

Status: Active » Needs review
454 bytes

I didnt have a ton of time to test this, but I think this should work.... can you please kick the tires

mrtoner’s picture

Status: Needs review » Reviewed & tested by the community

Seems to work fine, if




bleen’s picture

Status: Reviewed & tested by the community » Fixed

ok .. I committed this to dev (with "select" spelled correctly)


mrtoner’s picture

Any chance of getting the returned results sorted alphabetically?

bleen’s picture

mrtoner ... open a new issue (feature request)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mrogers’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

Just want to confirm that I experienced this issue today (both with stable and dev) and the patch in #7 fixed it.

bleen’s picture

I dont understand ... this was added to DEV here: http://drupalcode.org/project/autocomplete_widgets.git/commit/9664748. Did you have to re-patch?

mrogers’s picture

Yep, had to repatch. It's not in the 7.x dev version linked on the project page, as far as I can tell.