I'm using this module's "node reference with create" widget in a field collection entity and after the latest field collection update I'm getting an error in the noderefcreate_autocomplete_validate() function when creating or editing content. The error is:

Notice: Undefined index: [field name] in noderefcreate_autocomplete_validate() (line 88 of [drupal path]/sites/all/modules/noderefcreate/noderefcreate.module).

As a result of this error, no data is stored.

CommentFileSizeAuthor
#6 patch-1295112.txt1.07 KBcharlie-s
#1 noderefcreate.tar_.gz2.23 KBchrisolof

Comments

chrisolof’s picture

Status: Active » Needs review
StatusFileSize
new2.23 KB

I went in and fixed this today, but when I went to make the patch using git I realized the version git downloads already contains the fix. So for whatever reason, the version of this module you're presented with for downloading on the module's project page doesn't match to what you get when you grab it via git. Long story short - if you're having trouble with this module inside of a field collection the fixed version is available via:

git clone --branch 7.x-1.x http://git.drupal.org/project/noderefcreate.git

Or, if you don't have git installed, I've attached the fixed version of the module.

The fix entailed replacing these two lines (88 and 89) in noderefcreate.module:

  $field = $form_state['field'][$element['#field_name']][$element['#language']]['field'];
  $instance = $form_state['field'][$element['#field_name']][$element['#language']]['instance'];

With these instead (which come from the node reference module in a very similar validation function):

  $field = field_widget_field($element, $form_state);
  $instance = field_widget_instance($element, $form_state);
chrisolof’s picture

UglyKidJoe’s picture

Hi all,

This module is so useful! It solves a lot of issues for me (if it works!)

I've installed version 7.x-1.0 from the site (I don't use git).

Further error messages I get are:
- EntityMalformedException: missing bundle property on entity of type node in entity_extract_ids() (line 7501 of [...])
- Undefined index: field [field name].

Is it possible that I've broken this somehow?

Any updated on this issue would be greatly appreciated. Thanks for a great module.

wormz30’s picture

following... I'm experiencing the same exact problem

socialnicheguru’s picture

can a proper patch be created?
also it contradicts this patch http://drupal.org/node/1330274

charlie-s’s picture

StatusFileSize
new1.07 KB

Patch attached. Combination of this + 1330274.

vip_sa’s picture

The patch does not work and I still get the same error:

Notice: Undefined index: field_company in noderefcreate_autocomplete_validate() (line 88 of /home/investor/public_html/sites/all/modules/noderefcreate/noderefcreate.module).
Notice: Undefined index: field_company in noderefcreate_autocomplete_validate() (line 89 of /home/investor/public_html/sites/all/modules/noderefcreate/noderefcreate.module).
Notice: Undefined index: field_project in noderefcreate_autocomplete_validate() (line 88 of /home/investor/public_html/sites/all/modules/noderefcreate/noderefcreate.module).
Notice: Undefined index: field_project in noderefcreate_autocomplete_validate() (line 89 of /home/investor/public_html/sites/all/modules/noderefcreate/noderefcreate.module).