Noticed a similar issue but I'm not sure it's entirely related : #1276272: Don't display bundle selection if the entity type doesn't have a bundle key

I get the following error when trying to add a value in an autocomplete Entity Reference field :

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: http://test.localhost/entityreference/autocomplete/tags/field_account/profile2/main
StatusText: Service unavailable (with message)
ResponseText: EntityMalformedException: Missing bundle property on entity of type profile2. in entity_extract_ids() (line 7409 of /Users/test/drupal7/docroot/includes/common.inc).

Context : protecting the Entity Reference field with basic Field Permissions (http://drupal.org/project/field_permissions) for the administrator role only. When doing exactly the same operations with a Taxonomy Term autocomplete field it works smoothly.

CommentFileSizeAuthor
#13 entityreference_drupal_exit.patch225 bytesJaza

Comments

patmacs’s picture

I'm getting this error as well. subscribing

jdlind38’s picture

I had the same issue. I noticed that the Field Permissions module pushed out a new beta (7.x-1.0-beta2). The autocomplete started to work and the error went away. Make sure that the "Don't sort" option is selected in the reference field.

Sounds like EntityMalformedException is having the same issue.

zilla’s picture

i'm having the same issue as well, only when using one of the two available autocomplete options (select and radio are fine). i do not use field permissions module, and i'm at a loss regarding the source of this issue. however, i suspect some kind of module conflict, though not sure what would be the hitch...

LEternity’s picture

Subscribe

chrisschaub’s picture

I think entityreferece is breaking all of my autocomplete widgets. It's the odd man out. I'm getting the same error, tried upgrading field_permissions. But no luck. Trying to debug.

jordanmagnuson’s picture

In my case the devel_themer / simplehtmldom modules were causing this.

Rebekaloz’s picture

This happens when some contributed modules are enabled.

Here Alexey from Italy sais: " I found out what causes AJAX error! When I turn on any module with utf8 incoding it causes the error, when i change the encoding to ANSI or to utf8 without BOM, everything works. This incoding problems happened only in Google chrome, in Firefox all encodings work well "

http://stackoverflow.com/questions/7859823/an-ajax-autocomplete-textfiel...

I just need to know how to change a module encoding. How to apply Alexey solution.

Any ideas how to change a module encoding?

lsolesen’s picture

Status: Active » Postponed (maintainer needs more info)

Is this still an issue with the latest dev, then please update the Version field and set back to active.

player259’s picture

same issue, latest dev

workaround
entityreference.module line 1069

add exit();
after drupal_json_output($matches);

charlie charles’s picture

Issue summary: View changes

Hi player259
can you make a patch for this please?

isolate’s picture

Please note this could be due to your entity not having a proper label callback but it's using a standard callback function for it: "entity_class_label". You should change this and implement the callback yourself.

Otherwise you will get this notice: Notice: Undefined index: label in Entity->defaultLabel() (line 146 of entity/includes/entity.inc). (Which will throw the AJAX error ofcourse)

foagth’s picture

in my case, autocomplete didn't work for 2 fields referencing a term and a node type.
The ajax error message did actually have the expected result in the response.

The fix was to use jquery update module and set the jquery 1.8 as the default.
This also fixed another error with the date popup not displaying.

I'm using ent ref version 1.1

Jaza’s picture

Version: 7.x-1.0-beta3 » 7.x-1.x-dev
Assigned: Unassigned » Jaza
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new225 bytes

Same as player259 in #9, I fixed this by adding drupal_exit() at the end of the AJAX callback function.

Patch attached - would be good to get this into the module.

Status: Needs review » Needs work

The last submitted patch, 13: entityreference_drupal_exit.patch, failed testing.

yfarooq’s picture

in my case it was twitter module https://www.drupal.org/project/twitter

if your using twitter module you might disable twitter module and check if everything work.