Warning when using with field that is an entity_reference select list

Created on 18 June 2020, over 4 years ago
Updated 5 June 2023, over 1 year ago

Hi,

When using this module with a field that is an entity_reference select list I get this warning.

Warning: Illegal string offset 'value' in unique_field_ajax_validate_unique() (line 219 of ...modules/unique_field_ajax/unique_field_ajax.module)

It works but I rather avoid the warning and I don't think that code will work with the autocomplete entity_reference field. I will be attaching a patch that probably needs more code added to it to make it generic for different field values. I also haven't tested it with Ajax.

Daniel

πŸ› Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dmundra Eugene, OR

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.

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

    Somehow I'm getting this error while using unique on Entity Reference fields. Two content types were set up with fields using Entity Reference and were working for the past few months on my devel site. Today all of the sudden, the unique constrain stopped working and I'm getting this (or similar) error in the status log. User are able to create new content with the same field value set to be unique. My specific error is "Warning: Illegal string offset 'target_id' in unique_field_ajax_validate_unique() (line 572 of ...../modules/contrib/unique_field_ajax/unique_field_ajax.module)"

    Running D9.5.9 and Unique Field Ajax 2.1.2

  • πŸ‡ΊπŸ‡ΈUnited States dmundra Eugene, OR

    Interesting @jmouse888, for this line https://git.drupalcode.org/project/unique_field_ajax/-/blob/2.1.2/unique... in your site can you output what is the structure of $value?

Production build 0.71.5 2024