OS: OSX 10.5.8
Stack: MAMP Version 1.8.4 (1.8.4)
Webserver/PHP name and version: Apache/2.0.63 (Unix) PHP/5.2.11 DAV/2
Drupal dev nightly build 03/30/2010
Drupal Path: MAMP/htdocs/drupal-7.x-dev

Note: This is repeatable on drupal-7.0-alpha3

Goal: Term containing comma
Example: Einstein, Albert
Reason: It is common practice in library vocabularies to list last name, first name. This practice is also widely adopted in other fields and for other forms of titles and terms.

To elicit faulty behavior:
Step one - add term to vocabulary
Step two - enter for Name field - "Einstein, Albert"
Step three - click Save
Step four - view response - "Created new term Einstein, Albert."
Step five - click List tab
Step six - view List tab - There is no entry for "Einstein, Albert"
Step seven - create new content - "Homepage for scientists"
Note: Content type manage fields info:
Label = Scientist
Name = field_scientist
Field = Term reference
Widget = Autocomplete term widget (tagging)
Step eight - fill out all required fields and enter into field Scientist = "Einstein, Albert"
Step nine - click Save
Step ten - view response - "Scientist: this field cannot hold more than 1 values."

Note one: In an non-repeatable instance, it worked. However, no other attempts have succeeded.
Note two: Behavior is identical when also adding a description to taxonomy in step two.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

worldlinemine’s picture

Additional information:
I was able to reproduce "Note one: In an non-repeatable instance, it worked. However, no other attempts have succeeded." and thus have a poor work around.

Work around:
After creating a non-comma delimited term (ie. Name = Einstein), upon editing of the term it is possible to switch it to (ie. Name = Einstein, Albert).

Negative consequence:
The term is no longer searchable via Widget = Autocomplete term widget (tagging).
The term also no longer appears in vocabulary lists.

Conclusion:
A coded fix to handle terms with commas would be desirable.

Note:
Oddly enough terms like: Name = "Einstein. Albert" and Name = "Einstein: Albert" do work, so I suspect comma is being used internally for taxonomy.module

mr.baileys’s picture

Category: bug » support
Priority: Minor » Normal
Status: Active » Fixed

You can surround taxonomy terms with quotes. So Apple, Banana, "Einstein, Albert" should create 3 terms, not 4.

worldlinemine’s picture

Status: Fixed » Active

Thank you very much for that info.

Several things to note:
The term is still not searchable via Widget = Autocomplete term widget (tagging).
However, the term does appear in the proper vocabulary list.
The term also can be reused, so if one uses "Einstein, Albert" for two or more different nodes even though auto-complete can't find the term it does show up as linked to the same term after saving the new node rather then attempting to create the term multiple times.

mr.baileys’s picture

Category: support » bug
Status: Active » Closed (duplicate)

Correct, there is a problem with autocompletion of quoted terms. There already is an issue open for that though, #321080: Usage of Quotes in tag in combination with taxonomy_autocomplete, so it's probably best to continue the discussion there. If you are comfortable applying patches, you might want to test the patch offered there and provide feedback to move that issue forward.

magnusk’s picture

Title: Taxonomy difficulty handling terms with commas » Taxonomy autocomplete validation incorrectly handles single-cardinality term with comma
Status: Closed (duplicate) » Active
FileSize
915 bytes

This issue is not a duplicate of autocompletion with quoted terms.

Problem: If a taxonomy field has single cardinality there is an incorrect autocomplete validation if the term name happens to contain a comma. The error message is very confusing for regular people who enter content on a Drupal site.

Correct behavior: The term name should be accepted as is, but the validation in taxonomy_autocomplete_validate() incorrectly assumes that the value is a comma separated list of terms. This is only true if the cardinality of the field is greater than one.

Proposed solutionL I'm attaching a proposed patch, calling drupal_explode_tags() only if the field cardinality is greater than 1.

andypost’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: -comma, -delimiter +Needs tests

@magnusk please provide a patch in unified format
also this should be fixed in 8 first

jibran’s picture

Component: taxonomy.module » entity_reference.module
Status: Active » Postponed (maintainer needs more info)

After #1847596: Remove Taxonomy term reference field in favor of Entity reference taxonomy field is converted to ER field. If this problem exists then it's a common problem so moving it to ER queue. Marking it postpone (maintainer needs more info) because we want to verify if there is still a problem or not.

amateescu’s picture

Title: Taxonomy autocomplete validation incorrectly handles single-cardinality term with comma » Allow single-cardinality fields to not require wrapper quotes for strings that contain special characters
Status: Postponed (maintainer needs more info) » Needs review
Issue tags: -Needs tests +Needs manual testing
FileSize
1.22 KB

I think this is all we need to fix the problem but we need to confirm that with some manual testing.

jibran’s picture

Issue tags: +Needs tests

It could also use some Web Tests.

amateescu’s picture

So the fix is not so simple because Drupal\system\Controller\EntityAutocompleteController::handleAutocomplete() also splits the string unconditionally with Tags::explode().

Anyway, the test for this should probably be added at the bottom of Drupal\system\Tests\Entity\EntityAutocompleteTest::testEntityReferenceAutocompletion().

mgifford’s picture

Re-uploading #8 for the bots.

Status: Needs review » Needs work

The last submitted patch, 11: 758992-8.patch, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jibran’s picture

Component: entity_reference.module » entity system

Moving to right component

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

pameeela’s picture

Status: Needs work » Closed (cannot reproduce)
Issue tags: +Bug Smash Initiative
FileSize
11.03 KB

Can't reproduce this, guessing since it was converted to ER. I've tried the steps in the IS and every way I could think of but it adds quotes and always works for terms with a comma.

If anyone has updated steps please add them to the issue summary and re-open this.