Hi,

There is a trivial bug in taxonomy_autocomplete (modules/taxonomy/taxonomy.pages.inc), that makes it impossible to autocomplete terms containing a comma or quotes.

If you want to reproduce, add a autocomplete free-tagging field to a entity, save it with a value like "work, this doesn't", save. The term is created. Try to create a new entity, enter in "work" - the term isn't autocomplete like it should.

The reason for this is that terms are only added to the list of term_matches, iff it isn't necessary to quote the term before returning it. The term should always be added, even if it needed quoting.

Comments

fangel’s picture

And here's the patch to correct the problem.

joachim’s picture

This has already been reported, and there's a patch at #1000736: Term reference autocomplete widget having problems handling terms with commas.

Can you compare that one and yours please?

fangel’s picture

Status: Needs review » Closed (duplicate)

Sorry, I tried looking for existing issues but I must have missed it. That issue contains my fix + another part I had missed.

joachim’s picture

No problem; happens to us all :)

Any chance you have time to review that other patch?

mattbk’s picture

I am having the same problems even after upgrading to 7.8. I have checked the files and the patch (from the other issue) seems to have been committed. I have run cron and cleared caches. fangel, are you still having problems?

EDIT: To clarify, I am only having autocomplete issues when exposing a term field in Views. Would this comment be better off in the Views issue queue?

fangel’s picture

mattbk: Yes, the issue still remains in Views - but this is a Views bug, not a Drupal Core one (more specifically, it's a bug in views_ajax_autocomplete_taxonomy)

fangel’s picture

mattbk: I've created an issue in the Views issue-queue with a patch that should fix the problem - care to check it out? #1278694: Unable to autocomplete terms containing commas or quotes.

mattbk’s picture

mrded’s picture

Title: Unable to autocomplete terms containing commas or quotes. » Unable to autocomplete terms containing quotes.
Version: 7.x-dev » 7.23
Status: Closed (duplicate) » Needs work

I caught this problem again on fresh Drupal 7.23 installation.

Steps to Reproduce:

  • Create term with quotes into name
  • Add a autocomplete field to a entity
  • Try to fill this field

Actual Results: Widget will wrap each quote to another quotes.
Expected Results: Widget should insert term's name without extra quotes.

Please, take a look the video: http://d.pr/v/rk6y

mrded’s picture

Title: Unable to autocomplete terms containing quotes. » Unable to autocomplete terms containing commas or quotes.
Version: 7.23 » 7.x-dev
Status: Needs work » Closed (duplicate)

Sorry, I misunderstood this issue. After submit it works how it should be.