Greetings Josef,

I'm facing a strange problem when trying to upload and image in the node form by clicking on the upload button.
I'm getting "An illegal choice has been detected. Please contact the site administrator."
and these log messages:

Type	php
Message	Notice: Undefined variable: new_field_state in entityreference_autofill_populate_form_by_field() (line 284 of /path/to/mysite/sites/all/modules/entityreference_autofill/entityreference_autofill.module).
Severity	notice

Referrer	http://mysite/en/node/add/content-type
Message	Illegal choice 22472 in Trim element.
Severity	error

even if chose the image without hitting the upload button, and hitting the submit button of the node form, the form will not submit, and it gives the same "an illegal choice has been detected" and my entity reference field is surrounded by red color.


  • Commit 4f8bd9f on 7.x-1.x by jgullstr:
    Issue #2236059 by mas0h: Stronger conditions on ajax callbacks, replaced...
jgullstr’s picture

Status: Active » Needs review

Hi mas0h,

The notice problem should be fixed in dev now, please check if you also can upload images now.

Thanks for your report,

mas0h’s picture

Status: Needs review » Closed (fixed)

I believe this issue is not related to your module, so please take an action!
The main discussion is here
Thank you!

romaingar’s picture

Hi, i've encountered the same problem with my entityform and a entityreference field based on a view. So i've just added that to entityreference_autofill.module (l.111)
And it works.... no more errors.

  if ($callback == 'entityreference_autofill_form_autofill') {
    //don't rebuid the form...