Autocomplete field doesn't allow to reference entities with long titles

Created on 18 July 2017, over 7 years ago
Updated 16 April 2024, 8 months ago

Problem/Motivation

When trying to reference an existing entity that has a very long title (title can be up to 255 characters), a validation error is thrown because the text added by the autocomplete js code will be longer than the maximum field size, which is set to 255. This is caused by the extra characters needed for the id to be included in the string (in the format "<title> (<id>)").

Proposed resolution

Use the same maxlength used by the \Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget, which is 1024.

Remaining tasks

Test maybe.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Needs work

Version

3.0

Component

Code

Created by

🇮🇹Italy sardara

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

Production build 0.71.5 2024