Problem/Motivation

The Entity Reference field has two display widgets: "Autocomplete" and "Autocomplete (Tags style)".
Both widgets allow users to add new taxonomy terms to a vocabulary as long as "Create referenced entities if they don't already exist" is enabled on the edit tab of the field. Terms cannot be added if that tick box is not ticked.

Proposed resolution

Since there doesn't seem to be any difference in the functionality of the two widgets "Autocompelete (Tags style)" could be removed.

Remaining tasks

User interface changes

API changes

Comments

ifrik’s picture

Berdir’s picture

I don't see what the bug here is.

Those widgets do work differently. Try them with cardinality unlimited to see the difference. tag style is "Tag A, Tag B, Tag C", the other one is multiple text fields.

Berdir’s picture

An idea I had in IRC is that we could hide the tags style widget when cardinality is 1. We can do that now easily with isApplicable().

ifrik’s picture

Sorry, I see the difference now: the "Autocomplete" widget gives seperate fields in which users can add one term each using autocomplete. That's certainly more usefull if users can add a limited number of terms.
While "Autocomplete (tag style)" is a multitext field. Users can add any numbers of terms, but they got a problem if they add more then the limited number.
And with both widgets it is possible to add new terms if that's enabled.

Then that's more a question of usability:
1) For content creators: If the "Autocomplete" widget is used when the field is limited to one value, then users can't see that, and might just tag by adding several, comma seperated terms - and then get an error message when saving. (It's fine once there are two fields.)
2) Site builders can easily confuse "Autocomplete (Tags style)" with tagging; assuming that that is the widget to choose if you want to allow content creators to add new tags (and overlooking the tickbox for thati in the process). Maybe renaming this widget to somethings like "multi term field (autocomplete)" would solve that.

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.

xjm’s picture

Title: Both "autocomplete" Entity reference widgets allow adding new taxonomy terms » Difference between "Autocomplete" and "Autocomplete (tags style)" is not entirely clear for site builders

Retitling to describe #4.

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.

akshitggrwl’s picture

When using the simple "Autocomplete" widget for multi value reference fields, the widget still allows to enter comma separated list, even though there is "Add another item" button available.
I think comma separated values should not be allowed in this case as the widget only stores the last term in the list of values for that delta.

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.

Joachim Namyslo’s picture

Maybe the difference is that only the last taxonomy term enterd is given to the user instead of a tag style list when viewing the page. I've tried to get a tag style list as in drupal 8.4.x but there is no chance to see more than one taxonomy terme at onece when you viewing the content outside the edit form.

Pancho’s picture

Version: 8.5.x-dev » 8.6.x-dev
Component: entity system » entity_reference.module
Category: Bug report » Task

UI-wise, I would propose turning the “tags style” into a mere widget setting of a single Autocomplete widget, made available only for cardinality≠1. Site builders would be able to choose from “Inline” and “multi-line” widget styles. We need to figure out though, how this would work out DX-wise.

If this route shouldn’t work out well, we should at least hide the Tags-style widget for cardinality=1, as per #3.

We also have to disallow CSV for regular Autocomplete widgets, as per #11. I will however file a separate issue for what actually constitutes a bug.

jibran’s picture

Component: entity_reference.module » entity system

entity_reference module doesn't have any active code anymore.

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

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now 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.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.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.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). 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.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now 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.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

MacSim’s picture

It could be fun and more user friendly to add a Vanilla input tags script to that "Autocomplete (tags style)"
Something like https://github.com/yairEO/tagify

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

hmendes’s picture

Some notes:

There's an explanation of the difference between Autocomplete and Autocomplete (Tags style) in /admin/help/field:

  • The Autocomplete widget displays text fields in which users can type entity labels based on the Allowed number of values. The widget can be configured to display all entities that contain the typed characters or restricted to those starting with those characters.
  • The Autocomplete (Tags style) widget displays a multi-text field in which users can type in a comma-separated list of entit labels.

About what was said in #4 and #11
1) For content creators: If the "Autocomplete" widget is used when the field is limited to one value, then users can't see that, and might just tag by adding several, comma separated terms - and then get an error message when saving. (It's fine once there are two fields.)

When you have a Taxonomy reference field with cardinality = 1, and Autocomplete(Tags) display, if you try to add more terms after the comma, it will give you an error
taxonomy field: this field cannot hold more than 1 values.

But, if the display is Autocomplete and you try to do the same thing, it won't give an error and will replace the value of the field.

Example:
You have a Taxonomy field and you save it with the term "term1". If you edit the content and try to add the "term2" with comma (so it will be "term1 (1), term2 (2)", it won't give you an error and will save the field with the "term2". (both with cardinality=1 and unlimited)

Should this be the default behavior?

I agree with the comment #14 about turning the Tags styles into a Autocomplete widget setting.

gxleano’s picture

#22 I've already created a module with a Tagify integration to make the autocomplete (tags style) fields more user friendly, you can see it here https://www.drupal.org/project/tagify.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

GuyPaddock’s picture

Thoughts:

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

caspervoogt’s picture

I stumbled across this issue because I was using "Autocomplete (Tags style)" and completely forgot that for multi-value fields the user is supposed to enter commas. The UI does not mention this.