Error using SPDisplayRelatedInfo

Sep 15, 2009 at 7:04 PM
Edited Sep 15, 2009 at 7:04 PM

I keep recieving the following error trying to use the SPDisplayRelatedInfo.

'relatedClumnsXML[...]' is null or not an object

jquery.SPService-0.2.10.js

I have a lookup column of 19 text items. Is there something that I am missing?

<script type="text/javascript">
if(typeof jQuery=='undefined'){
 var jQPath = '/_layouts/jquery-1.3.2.min.js';
 document.write('<script src="',jQPath,'" type="text/javascript"><\/script>');
}
</script>
<script type="text/javascript" language="javascript" src="../../scripts/jquery.SPServices-0.2.10.js"></script>
<script type="text/javascript">

 $(document).ready(function(){ 
  $().SPServices.SPDisplayRelatedInfo({
   columnName: "Course Title",
   relatedList: "Courses",
   relatedListColumn: "Title",
   relatedColumns:["Location","Start_x0020_Time","End_x0020_Time"],
   displayFormat: "table"
  });
 });
 
 
</script>

Coordinator
Sep 15, 2009 at 7:17 PM

Does the error really say 'relatedClumnsXML[...]'? I just checked my code, and I don't have that misspelling.  (I was worried there for a sec!)

relatedColumnsXML contains the Field information about each column which is returned from the GetList operation.  It looks like this error would be thrown if one of the relatedColumns you have specified: ["Location","Start_x0020_Time","End_x0020_Time"] isn't in the relatedList.  Could you check your column names again and make sure that they are all present in the Courses list?

M.

Sep 15, 2009 at 7:26 PM

Sorry about the misspelling. Here is what I'm finding. If I use the internal name in the relatedColumns I do not recieve an error but nothing happens. My code has changed to this:

<script type="text/javascript">
if(typeof jQuery=='undefined'){
 var jQPath = '/_layouts/jquery-1.3.2.min.js';
 document.write('<script src="',jQPath,'" type="text/javascript"><\/script>');
}
</script>
<script type="text/javascript" language="javascript" src="../../scripts/jquery.SPServices-0.2.10.js"></script>
<script type="text/javascript">

 $(document).ready(function(){ 
  $().SPServices.SPDisplayRelatedInfo({
   columnName: "Course Title",
   relatedList: "Courses",
   relatedListColumn: "Title",
   relatedColumns:["Location","EventDate","EndDate"]
  });
 }); 
</script>

Coordinator
Sep 15, 2009 at 7:43 PM

Is there a JavaScript error in the bottom left of your browser (assuming you are using IE)?  Is the Courses list in the same site?  Does the "Course Title" selection match one of the item's "Title" column in the Courses list?

M.

Coordinator
Sep 15, 2009 at 7:47 PM

p.s. Let me know where the documentation isn't helping in all of this, too: http://spservices.codeplex.com/Wiki/View.aspx?title=%24%28%29.SPServices.SPDisplayRelatedInfo

M.

Sep 15, 2009 at 7:48 PM

There is no longer an error in the bottom left in IE 8 and Yes the Courses list is in the same site. The Courses Title is a lookup column into the Courses list Title column.

Coordinator
Sep 15, 2009 at 8:12 PM

OK, all sounds as if things are set up correctly.

So when you change the selection in the 'Course Title' column on the form, nothing happens?  You don't see the column headers?  (Which ought to be: "Location", "Start Time", and "End Time" based on what you've shown above.)

It looks like the Courses list is an Events list, correct?  I'll do some testing on this end with an Events list.

M.

Sep 15, 2009 at 8:32 PM

I'm using IE Developer Tools trying to see what's going on. When the page loads it steps through the code but not when I select somethinig in the drop-down. An event not being raised? I've restricted the values in the relatedColumns parameter to just relatedColumns:["Location"] but nothing has changed and removed the number of entries to 19. Still nothing. I did notice that the Title column (default) was renamed to Course Title but the internal name is still Title.

Thanks for your help.

Marcus

Coordinator
Sep 15, 2009 at 8:43 PM

I've got my test list trying to show related info from a Calendar list and I'm seeing the same thing as you.  Let me do some debugging...

M.

Coordinator
Sep 15, 2009 at 9:01 PM

I found the bug.  It was cause by the space in 'Course Title'.  Bad slip on my part.  I have a fix; I'll upload it now.

Sorry about this.

M.

Sep 16, 2009 at 12:01 AM

Great!!! Everything is working. The only comment I have is that I had to use the internal name for the relatedColumns and not the display names. I didn't see anywhere in the documentation that this was stated.

Thanks again for the help.

Sep 16, 2009 at 12:31 AM

This is working so well that I have to ask if you have built in SPService the functonality to populate a form field from calling a web service. Much like SPDisplayRelatedInfo just take the returned value and place it in a form field.

Thanks again for everyting and mentioning me on your site

Marcus

Coordinator
Sep 16, 2009 at 12:32 AM

Glad we got you up and running!  Take a look at the docs.  It actually does say internal name.  How can I say it more clearly so that no one else gets stuck?

http://spservices.codeplex.com/Wiki/View.aspx?title=%24%28%29.SPServices.SPDisplayRelatedInfo

M.

Coordinator
Sep 16, 2009 at 12:34 AM

I'm going to take your populate form field idea and turn into a new work item in the Issue Tracker because it seems like a useful idea.  Can you add any other thoughts there that would make it useful for you?  Options that would be helpful? etc.?

Thanks,

M.

Coordinator
Sep 16, 2009 at 12:35 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.