Autocomplete with tagging silently discards invalid input

Created on 2 November 2011, about 13 years ago
Updated 25 February 2023, almost 2 years ago

Problem/Motivation

Entity reference autocomplete with tagging silently discards invalid input.

The taxonomy autocomplete widget's input validation silently discards invalid input.
Invalid meaning according to the RFC 4180 (http://tools.ietf.org/html/rfc4180) CSV format.

Steps to reproduce

To reproduce:

  1. Create a node type.
  2. Add entity reference field, enable tagging mode.
  3. Use "Autocomplete (tags style) widget.
  4. Create new node, see User input column in table above.

This saves the node but not the (invalid) tag and does not show any error message.

Proposed resolution

Determine what input format to adopt for input values. It is suggested in several comments to use the RFC 4180 CSV format.
Determine how to handle discarded input

Remaining tasks

Confirm the use of RFC 4180 CSV format
Why not deprecate explode?

Review
Commit

User interface changes

Error message on invalid input

API changes

Data model changes

Release notes snippet

Original report by hefox

  1. Go to a node type with free tagging
  2. Input "Blah blah blah (notice no trailing quote)
  3. Save node
  4. Notice that the term was not saved and no error was produced
πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
FieldΒ  β†’

Last updated 3 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States hefox

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    This was a bugsmash triage target earlier in the week. This needs an evaluation of the use of the RFC as the standard to follow. It is not clear to me why a new method is being added instead of deprecating the existing one. I have added both of those to the issue summary.

    I decided to update the patch to 10.1.x.

    Since this has not been worked on in 5 years I am changing this to 'un-assigned'.

  • Status changed to Needs work almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Can confirm the issue on Drupal 10.1
    Using a standard install I used the Articles tags field using the values in the issue summar
    Patch #69 does solve the proble.

    safeExplode
    1. Should be typehinted

    // Find end single quote.
    2. Think this could be written better.

    // End of string. Finish.
    3. Same

    +        // Handle tags not in quotes.
    +
    +        // Determine where the tag ends.
    

    4. empty space

    5. Can we get a test only patch to see they fail.

    Thanks!

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Also IS has a remaining task

    Why not deprecate explode?

    Which should be answered.

Production build 0.71.5 2024