Comments

lifeinpoetry’s picture

Title: Bundle with -'s in drupalgap_field_info_instances returns null » Bundles with -'s cause cannot read property errors
Issue summary: View changes
tyler.frankenstein’s picture

Status: Active » Needs work

Thanks for pointing this out. I'll try to fix this as soon as possible. In the mean time, please check out the developer's guide if you're interested in attempting this fix:

http://www.drupalgap.org/node/194

Thanks!

tennist’s picture

tennist’s picture

Issue summary: View changes

I noticed that my DrupalGap add content type forms were not working at all. They would say 'undefined' in my test app and in Ripple. The following error would be returned in Ripple:

image_fields_present_on_entity_type - TypeError: Cannot read property 'length' of undefined drupalgap.js
_drupalgap_form_render_elements - TypeError: Cannot read property 'nid' of undefined drupalgap.js

I traced this back to image_fields_present_on_entity_type having my content type as 'pop-song' instead of 'pop_song' so when drupalgap_field_info_instances was called it would return null because the node object listed my content type as 'pop_song.'

I see the second error in _drupalgap_form_render_elements is caused by form.bundle having hyphens (in my case).

Hopefully this is enough info to fix this bug.

tennist’s picture

Have either of you solved this issue yet. I believe I am running into the same issue with "_" in the bundle name. I am trying to add giftcard purchase support to drupal gap and get a very similar error when trying to load the add to cart form. Giftcard purchases require the commerce_line_item bundle giftcard_purchase. When the app tries to load the add to cart form I get the following error:

"_drupalgap_form_render_elements - TypeError: Cannot read property 'submit' of undefined"

Funny thing is if I remove the submit button from the add to cart form this error goes away and the form generates as expected. Without the submit button.

tyler.frankenstein’s picture

Status: Needs work » Active