Notice: Undefined index: relation_id in _relation_select_field_widget_form() (line 530 of /Applications/MAMP/htdocs/tkdclub/sites/all/modules/relation_select/relation_select.module).

* I get this error on node/add/ct1 that contains a relation select widget (ct1 to ct2)
* The node is saved and I don´t get the error on node/edit

Test
* Created a new relation type
* Selected directional and two content types (ct3 to ct4)
* Added a relation select widget on ct3.
* Did node/add/ct3

I get no error BUT the relationselect widget from ct1 is being loaded.

These are two problems in the same post but I assume they are related.

Comments

busla’s picture

update:
I´ve deleted the Relation Type and added new ones but still I get the one I deleted if I add a relation select widget to a content type. All the relation tables are empty so I have no idea where it´s being loaded from.

busla’s picture

another update:

It´s a problem related to the views used in with the widget. If I change the relation view used by the widget I get an error.


Reproduced:

  1. Create a relation type
  2. Relate two content types (ct1 and ct2)
  3. Add a relation select widget on ct1 and choose the "Relation select : Node : Master" view.
  4. Add a node in ct1 and add a relationship to a node in ct2.
  5. Go to views and clone "Relation select : Node : Master".
  6. Change the filter on "Content: Type" and deselect exposed and select the operator "is one of" ct2. Apply and save.
  7. Admin -> Structure -> Types -> Manage -> ct1 -> fields -> your relation field
  8. Select the cloned view you made earlier and save the settings.
  9. node/add/ct1
  10. Error.

This doesn´t seem to be related to the view itself but when I change to a different view. The cloned view works fine and doesn´t give me an error when I reverse the process and select my custom view in step #3 instead of "Relation select : Node : Master".

Then when I switch to the "Relation select : Node : Master" view it throws an error.

nancydru’s picture

I even restored it to essentially the original state (i.e. re-exposed the filter) and it still does this.

kimwes’s picture

Here's a patch only to remove the notice. I didn't search for the root cause.

robertom’s picture

This is a duplicate of bug #1803408: Content Creation with Relate Fields: Undefined index: entity_id in _relation_select_field_widget_form()

the difference from "Undefined index: entity_id" and "Undefined index: relation_id" is due to this commit