I'm trying to add Entity Reference-field that is using Select List-widget to my form, but the field shows up empty and I receive following error messages:

[Log] options_field_widget_form - unknown widget type: entityreference (drupalgap-7.0.2.min.js, line 4)
[Log] entity_primary_key - unsupported entity type (null) - to add support, declare null_primary_key() and have it return the primary key column name as a string (jdrupal-7.0.5.min.js, line 1)
[Log] entity_primary_key_title - unsupported entity type (null) (drupalgap-7.0.2.min.js, line 4)
[Log] _theme_entityreference_pageshow_success - TypeError: window[options.entity_type_index] is not a function. (In 'window[options.entity_type_index]', 'window[options.entity_type_index]' is undefined)

The same thing happens with Checkboxes. Entity Reference-field works as designed while using Autocomplete-widget. I have followed these docs to generate the field: http://docs.drupalgap.org/7/Forms/Form_Elements/Autocomplete/Autocomplet...
http://docs.drupalgap.org/7/Entities/Entity_Reference

Comments

fantastiko created an issue. See original summary.

x7ian’s picture

Hello im having this same issue.
Im using entityreference field and when i use the Autocomplete widget it works, partially because the autocomplete show items from all content types(looks like it searches on every node in the site, not only the ones from the content type selected for the entity reference field).
Hoe ever if i try to use the select widget it just dissapears and show the following errors

options_field_widget_form - unknown widget type: entityreference  drupalgap-7.0.2.min.js:5:16232
"GET: http://localhost/sandbox.codeatrium/?q=drupalgap/taxonomy_term.json&parameters[vid]=2&options[orderby][weight]=asc&options[orderby][name]=asc"  jdrupal-7.0.5.min.js:2:63
"GET: http://localhost/sandbox.codeatrium/?q=drupalgap/taxonomy_term.json&parameters[vid]=3&options[orderby][weight]=asc&options[orderby][name]=asc"  jdrupal-7.0.5.min.js:2:63
entity_primary_key - unsupported entity type (null) - to add support, declare null_primary_key() and have it return the primary key column name as a string  jdrupal-7.0.5.min.js:1:10659
entity_primary_key_title - unsupported entity type (null)  drupalgap-7.0.2.min.js:5:8270
_theme_entityreference_pageshow_success - TypeError: window[options.entity_type_index] is not a function
x7ian’s picture

Hi ive just realized that this problem arises when there are more that one entity reference field using select widget on a form.
The first one shows up just fine, however the others dont show. They ony show the label and no widget, unless they are using the autocomplete option.
So this leaves me with only one option wich is to create the form manually and use services to create/edit the corresponding entity.
I would like to study the situation and dive into the entity reference module to find the problem, however im just begining with DrupalGap and i have no idea where to begin. The error that shows up its on the DrupalGap minified file,

options_field_widget_form - unknown widget type: entityreference drupalgap-7.0.2.min.js:5:16232

so i cant even know where to begin on the entityreference module.
Can anybody give a hint on where and why is this error happening?

tyler.frankenstein’s picture

I'd recommend building a custom form for adding/editing entities. I've come to the realization that every app is unique, and it's silly to try to replicate the Drupal UI inside the app when each app should have it's own interface.

These docs will lead you in the right direction:

http://docs.drupalgap.org/7/Entities/Editing_Entities
http://docs.drupalgap.org/7/Forms/Creating_a_Custom_Form
http://docs.drupalgap.org/7/Entities/Rendering_Entities

x7ian’s picture

Great, Thank you for the orientation!
I was kind of realizing that myself.
Yeah that makes sense and sounds like the right thing to do, since apps are usually very customized so we would need all the functionality of Drupal and maybe more, built in to drupalgap and thats kind of silly and i guess it would endup making it slow and heave.
Its great to have an amazing js api like drupalgap to work with and build what we need in an optimized way.
Thank you for your directions!

btw, thank you for all your time and energy working on this great project!!