I have a content type which includes an image field and a separate entity reference field (drop down box) connected to a view. When I try to save, the entity reference field gives an error (illegal choice...contact site admin), but it works perfectly well when I don't upload an image. Any ideas?

Comments

ladybug_3777’s picture

I have the same issue, but it occurs when I use a file field or an image field. I suspect this is somehow related to ajax events. If I select a file but don't press the "Upload button" it works fine. However if I do press "Upload" (Which fires and ajax event) I get the same error you see:

An illegal choice has been detected. Please contact the site administrator.

I've also noticed that removing a file or image (via the remove button, which also cause an ajax event) will throw this error.

Once the error has been thrown my drop down of entities is blank. If I cancel and go back to edit the content type my entities come back.

jemisond’s picture

Any fix or workaround for this?

tashaharrison80’s picture

Having the same issue - any ideas? I found this: https://www.drupal.org/node/1045208 but still no solution

ladybug_3777’s picture

I am using the patch (#5) I wrote on this post: https://www.drupal.org/node/2358049
to fix the issue. The problem is related to Views and ajax. If it works for you please leave feed back on that page.

ladybug_3777’s picture

FYI, anyone looking for more information on this issue may want to check out these posts as well. I found them while researching the issue:

https://www.drupal.org/node/2358049
https://www.drupal.org/node/1823506
https://www.drupal.org/node/2242773
https://www.drupal.org/node/1045208

tashaharrison80’s picture

Applied the patch and it didn't work, but that is probably because I'm having the issue on an Entityform. Should have read it first before excitedly applying.

infinet’s picture

Hi tashaharrison80

Did you find a fix?

I have described a similar bug here... does that sound like yours?
https://www.drupal.org/node/2429173

Cheers
Scott

tashaharrison80’s picture

Hi infinet

No fix yet. I put this on the back burner for a couple of weeks and am just coming back to it today.

I think my issue to do with Views.

MustangGB’s picture

Status: Active » Closed (outdated)