_entityreference_autocomplete_validate is set as the validation handler for the autocomplete textbox on the subqueue edit page. It works when an entity is selected from the dropdown. If you enter in some random text and submit the form then there will be warning messages. This is because entityreference attempts to retrieve field information about an entity field, and the form field in this case does not actually correspond to any entity field.

    Notice: Undefined index: #field_name in _entityreference_autocomplete_validate() (line 895 of /sites/all/modules/entityreference/entityreference.module).
    Notice: Undefined index: #field_name in _entityreference_autocomplete_validate() (line 897 of /sites/all/modules/entityreference/entityreference.module).
    Notice: Undefined index: #entity_type in _entityreference_autocomplete_validate() (line 899 of /sites/all/modules/entityreference/entityreference.module).
    Notice: Undefined index: #bundle in _entityreference_autocomplete_validate() (line 899 of /sites/all/modules/entityreference/entityreference.module).

Comments

jmuzz created an issue. See original summary.

jmuzz’s picture

Status: Active » Needs review
StatusFileSize
new1.62 KB

Here is one simple way it might be fixed, copying some of the code from _entityreference_autocomplete_validate . It could be improved by searching for the element when the dropdown isn't used like the omitted part of _entityreference_autocomplete_validate does for entity fields.

frodri’s picture

Patch in #2 assumes the main module file is located in a sub-directory. I've attached a copy of that same patch with the correct directories set up.

amateescu’s picture

StatusFileSize
new672 bytes

I think it would be better if we just include all the information needed by _entityreference_autocomplete_validate(). Tested this manually and it works fine :)

  • amateescu committed c05f286 on 7.x-1.x authored by jmuzz
    Issue #2574289 by jmuzz, frodri, amateescu: Entityreference autocomplete...
amateescu’s picture

Status: Needs review » Fixed

Committed #4 to 7.x-1.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.