Step to reproduce

1)Used existing vocabulary eg: 'Tags' and Add term like "abc" and again add same term "abc" refer the image "taxonomy_terms"
2)Go to structure -> Content type.
3)Add field in existing content type eg."basic page", click on "managed field".
4)Add new field like "testing" and select field type "Term reference" as well as select widget "Autocomplete term widget (tagging)" and finish the step
5)Go to add content > basic page
6)Search taxonomy term like "abc" in auto complete text box then auto complete text box only show the one term "abc" but it not showing another term "abc".(refereed the screen "taxonomy_terms" where we have created 2 term).

Please help.

Comments

David_Rothstein’s picture

Title: Same taxonomy term not showing when "taxonomy_term_reference" field used in any content type » Multiple taxonomy terms with the same name do not show in the autocomplete widget
Version: 7.34 » 7.x-dev

Better title since this does not require multiple fields or content types to reproduce, just one field that is configured to use autocomplete (I tested it and was able to reproduce it just using the main "Tags" field on the article content type in the standard install profile).

Looks like Drupal 8 fixed this (perhaps inadvertently) as part of #675446: Use jQuery UI Autocomplete:

--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TermAutocompleteController.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TermAutocompleteController.php
@@ -200,7 +200,7 @@ class TermAutocompleteController implements ContainerInjectionInterface {
         if (strpos($name, ',') !== FALSE || strpos($name, '"') !== FALSE) {
           $name = '"' . str_replace('"', '""', $name) . '"';
         }
-        $matches[$prefix . $name] = String::checkPlain($term->label());
+        $matches[] = array('value' => $prefix . $name, 'label' => String::checkPlain($term->label()));
       }
       return $matches;
     }

But that was part of a larger change and it would take more than just that to fix in Drupal 7.

David_Rothstein’s picture

Priority: Critical » Normal

I don't see why this would be considered a critical bug.

ajaynimbolkar’s picture

Hi David,

Its critical because when my user try to update content then taxonomy id change because of same name of taxonomy term.

As provided patch would work? I think this was made for drupal 8

Thanks,
Ajay

aaronelborg’s picture

khaldoon_masud’s picture

I think we should create a new term reference field autocomplete widget, something like "Autocomplete term widget with term ID (tagging)"

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.