SCRIPT5007: Unable to get property 'SPCascadeDropdowns' of undefined or null reference

Nov 1, 2013 at 3:41 PM
Not sure why I am getting this error. I am calling the jquery reference first, and then SPservices. Here is the code, I placed it under PlaceHolderMain in the NewForm of the list.
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

<script language="javascript" type="text/javascript" src="..../SiteCollectionDocuments/jquery-1.8.2.min.js"></script>
<script language="javascript" type="text/javascript" src="..../SiteCollectionDocuments/jquery.SPServices-2013.01.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {

    // Set up the cascade from Location to Equipment
    $().SPServices.SPCascadeDropdowns({
        listName: "Work Orders",
        relationshipList: "Equipment",
        relationshipListParentColumn: "Location",
        relationshipListChildColumn: "Title", //Use the true name ("Title" was changed to "Name") 
        relationshipListSortColumn: "Title", //Use the true name ("Title" was changed to "Name")
        parentColumn: "Location",
        childColumn: "Equipment",
        debug: true
    });
});
</script>

<SharePoint:UIVersionedContent UIVersion="4" runat="server">
Coordinator
Nov 1, 2013 at 10:43 PM
It looks like your file references aren't good. The four dots?

M.
Nov 1, 2013 at 10:52 PM
Oh, i just deleted the front of them before I posted it. They are correct within the form though.
Coordinator
Nov 2, 2013 at 3:02 PM
Generally the error you are getting would mean that SPCascadeDropdowns isn't defined, which would imply that the reference to SPServices isn't good.

M.
Nov 2, 2013 at 6:01 PM
Very strange I know the references are correct. I literally right-click and copy the link location of the jquery file and SPServices, and paste it into the code. The crazy thing is, I just tested this on our test server and it works great. It refuses to on the live server though. Just throws that error.
Coordinator
Nov 3, 2013 at 5:42 PM
Do you have the file stored in the live server in the same location? Try using the CDN link instead:
//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2013.01/jquery.SPServices-2013.01.min.js

M.
Nov 4, 2013 at 1:12 PM
Tried the CDN, but still nothing. I get the same error.
<script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2013.01/jquery.SPServices-2013.01.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {

    // Set up the cascade from Location to Equipment
    $().SPServices.SPCascadeDropdowns({
        listName: "Work Orders",
        relationshipList: "Equipment",
        relationshipListParentColumn: "Location",
        relationshipListChildColumn: "Title",
        relationshipListSortColumn: "Title",
        parentColumn: "Location",
        childColumn: "Equipment",
        debug: true
    });
});
</script>
Coordinator
Nov 4, 2013 at 1:58 PM
You'll need to do some debugging. I'm almost positive that SPServices isn't loading.

M.
Nov 4, 2013 at 2:04 PM
Oh, I completely agree. This is driving me crazy.... I have the exact same lists on my test server and it works perfectly. I don't understand why the live server is any different.
Coordinator
Nov 4, 2013 at 2:08 PM
You should make the references "protocol-less", like this:

//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2013.01/jquery.SPServices-2013.01.min.js

The browser will load the files using the page's protocol.

If you are using http in one environment and https in the other, that could be the problem.

M.
Nov 4, 2013 at 2:11 PM
No luck there either. A good thought though.
Nov 4, 2013 at 2:19 PM
Got it!!! YES!!!!

Checked my V4.master and it was loading an old jquery CDN that wasn't on my test server. Deleted that and now it works perfectly!
Coordinator
Nov 4, 2013 at 2:24 PM
Whew.

M.
Nov 4, 2013 at 2:36 PM
Not sure why it was interfering... Glad it was found and fixed though. Thanks for all your suggestions and help sympmarc!