SPServices.SPCascadeDropdowns

Sep 13, 2011 at 9:57 PM

Marc, or anyone who can help, I can not seem to get this to work at all on either aspx pages built off of the default or on the default forms NewForm or EditForm. And have no clue why, this artical see so straight forward that I am thinking I forgot something.

 Below is the code I adapted from your article  

<script language="javascript" type="text/javascript" src="../../JqueryLibraries/jquery.SPServices-0.5.2.js"></script>
<script language="javascript" type="text/javascript" src="../../JqueryLibraries/jquery.SPServices-0.5.2.min.js"></script>
<script language="javascript" type="text/javascript">
 $(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "{372E3A6D-56E4-4F30-9387-F0F43E17E8EF}",
   relationshipListParentColumn: "CategoryID",
   relationshipListChildColumn: "CatType",
   parentColumn: "Category",
   childColumn: "Category_Type",
   debug: true
  });
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "{7C7B5384-7331-4065-AE17-FB392EB64C62}",
   relationshipListParentColumn: "Category_Type",
   relationshipListChildColumn: "TypeClass",
   relationshipListSortColumn: "ID",
   parentColumn: "CateType",
   childColumn: "Type Classification",
   debug: true
  });
 });
 </script>
In IE8 I get the following errors which I am at unsure why with that I am calling Services-0.5.2 not 0.6.2

Message: 'jQuery' is undefined
Line: 20
Char: 1
Code: 0
URI: https://sharepoint.sandia.gov/sites/DV6PMRS/dpmra/JqueryLibraries/jquery.SPServices-0.6.2.js


Message: 'jQuery' is undefined
Line: 19
Char: 1
Code: 0
URI: https://sharepoint.sandia.gov/sites/DV6PMRS/dpmra/JqueryLibraries/jquery.SPServices-0.6.2.min.js


Message: Object expected
Line: 797
Char: 2
Code: 0
URI:


I don't think that these errors have anything to do with it not working but they are the only errors I get when I load the page, nether of the child columns filter, no errors, nothing. Where do I need to paste this code to get it read by the browser, or do I need to downlaod more than just the js files into my Library to get this to work?

I have it currently just below the following:  

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

I know its somthing stupid I am not doing (the power button is turned on on my computer kinda thing), can you please help with this?



Coordinator
Sep 14, 2011 at 12:53 AM

It's not stupid, but it's basic. I see it all the time: getting the references to the .js files right is a hurdle you have to get right.

If you look at your two lines below, you're referencing the minified and non-minified versions of SPServices, but not jQuery itself.

<script language="javascript" type="text/javascript" src="../../JqueryLibraries/jquery.SPServices-0.5.2.js"></script>
<script language="javascript" type="text/javascript" src="../../JqueryLibraries/jquery.SPServices-0.5.2.min.js"></script>

You need to reference only the minified version of SPServices and the minified version of jQuery.

M.

Sep 14, 2011 at 8:57 PM

Thanks, this got it running. I have one question though, is there a way to trace (follow the url so to speak) the RelationshipList? I am now getting error messages from the debuger that the RelationshiplistParent and Child, don't exists in either list.  Below is the message for the first dropdown. I verified that the parentColumn and ChildColumn are found on the form, and when I run it, the dropdowns show (None) once I click continue on the error message so that part seem to be correct. Only thing I can think of at this point is that it's not reading the list columns, or I am not getting it to see the lists at all.  Have any ideas on this, a common error with a really quick fix?

Error in function
SPServices.SPCascadeDropdowns
Parameter
relationshipListParentColumn: CategoryID or relationshipListChildColumn: CatType
Message
Not found in relationshipList {372E3A6D-56E4-4F30-9387-F0F43E17E8EF}
I am referencing the the Parent and Child Columns by the Display name which is also the Static names. Verified the ID for the list even added the WebURL for the list, still get the error. 
Tried the list's Display name same error.
Tried without the {}, no error (I assume this means it didn't know what to do so it did continue.
CategoryID is a lookup in the list to the category list, CatType is the category type name for the item in the list (Title has always cause problems so I leave it in, but an empty field)
 $(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
   relationshipWebURL: "https://sharepoint.sandia.gov/sites/DV6PMRS/dpmra/Lists/",
   relationshipList: "{372E3A6D-56E4-4F30-9387-F0F43E17E8EF}",
   relationshipListParentColumn: "CategoryID",
   relationshipListChildColumn: "CatType",
   parentColumn: "Category",
   childColumn: "Category_Type",
Sep 19, 2011 at 5:34 PM
Edited Sep 19, 2011 at 5:34 PM

Just to close this discussion, I was missing an _ in the parentcolumn.  Working now. Thanks Marc for your help.

Coordinator
Sep 20, 2011 at 3:36 AM

Glad you got it working!

M.