Hello,
I'm getting this error when loading the edit form of a node with a Relation Select field:
relationSelectItems[id] is undefined
http://***/sites/all/modules/relation_select/js/relation-select.js
Line 187
I just fixed it with this patch:
--- relation_select/js/relation-select.js.orig 2011-10-23 16:06:00.000000000 +0200
+++ relation_select/js/relation-select.js 2011-10-23 16:09:41.000000000 +0200
@@ -183,8 +183,8 @@
* Get input
*/
function getInput(id, entitydata){
- return $('input[value="' + entitydata + '"]',
- relationSelectItems[id]['element']);
+ return (relationSelectItems[id]) ? $('input[value="' + entitydata + '"]',
+ relationSelectItems[id]['element']) : [];
}
function countArity(id){
Regards,
Maurizio
Comments
Comment #1
Yuri commentedI conform that this solved an issue for the latest dev version, in which (re)selecting a bundle and adding the relation was not possible.
Comment #2
Anonymous (not verified) commentedHave the same same problem, its something with wysiwyg that makes this error.
relationSelectItems[id] is undefined
[Break On This Error] relationSelectItems[id]['element']);
Comment #3
bwoods commentedThe patch seems to work but doesn't completely allow me to do what I need in my case. I'm using this module plus the Wysiwyg module. The issue is that the text area that allows HTML is being counted by the Relation Select module when allowing values to be selected. Instead of using the patch listed above, I made these modifications:
Starting at line 64
This automatically removes the initial text area field on edit page load.
Starting at (updated) line 144
I'm setting the ID variable to the name of my field. THIS IS NOT THE PROPER WAY TO DO THIS. But for now, this works for me.
Comment #4
imiksuHere are some patch files. A version is solution in description and B version is @bwoods without second edit (since it's not proper way as he said, and i agreed).
Comment #5
ensignavenger commentedI'm not sure if the two issues are the related, but I am having the same problem in two different places. Patch A resolves the error on line 187. However, I am getting the same error on line 193 (The countArity function).
I don't know enough JS to figure out how to fix it.
Also, patch B did not work for me, perhaps because it does not have the second edit or because I am not using WYSIWIG.
I opened another issue at http://drupal.org/node/1435980 which might be considered a duplicate of this one, if it is determined that the two are related.
Comment #6
Gray Fox commentedReview needed on this patch.
Comment #7
Gray Fox commentedResubmitted patch from #6, cygwin behaves strange with Windows paths.
Comment #8
chromix commentedPatch works for me. Thanks guys!
Comment #9
cbergmann commentedhi,
I also have this problem. applying the patch A from #4 solved the problem in line 187 but that leaves me with the line 193 problem. I am using wysiwyg with fckedit.
Comment #10
cbergmann commentedI also note that the problem occurs only while clicking on the first search results. When you hit the "Search" button once more you can select an entry and it will be added fine.
Comment #11
cbergmann commenteda workaround for this problem is using fckedit which is, according to first test, not conflicting with relation_select.
Comment #12
ben_scott commentedHi -
Thanks very much for the patches - I've applied the patch from #7 which seems to fix the issue.
Cheers,
Ben