SPServices undefined

Feb 3, 2014 at 5:43 PM
Edited Feb 4, 2014 at 7:28 AM
I am having a heck of a time getting this to work. I have combed all the discussions on this board and tried various methods to get this to work. My references below appear to be correct and I can navigate to the url without any issues.

The alert for jquery comes back, however the spServices is showing that it is undefined. I also receive the following error which I understand from another discussion on this board is already known.
<script type="text/javascript" src="/_layouts/CK.Central/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="/_layouts/CK.Central/js/jquery.SPServices-2013.02a.min.js"></script>


<script type="text/javascript">


 $(document).ready(function() {
alert("jQuery");
//alert($().SPServices.SPGetCurrentSite());


//return false;
$().SPServices.SPCascadeDropdowns({
relationshipWebURL: "/",
relationshipList: "Divisions",
relationshipListParentColumn: "Department",
relationshipListChildColumn: "Title",
relationshipListSortColumn: "ID",
parentColumn: "Departments",
childColumn: "Divisions",
debug: true
});

$().SPServices.SPCascadeDropdowns({
relationshipWebURL: "/",
relationshipList: "Sections",
relationshipListParentColumn: "Division",
relationshipListChildColumn: "Title",
relationshipListSortColumn: "ID",
parentColumn: "Divisions",
childColumn: "Sections"
});


});
</script>
I have 3 lists
Department List -> title column holds departments
Division List -> title column holds divisions with departments column lookup to departments
Section List -> title column holds sections with division column lookup to divisions

I have tried to move the files to a document library but that didn't work and I have spent too much time already trying to get this working so I thought I would reach out to see if you had any other suggestions for me to try.

Any help would be appreciated.
Coordinator
Feb 4, 2014 at 2:37 PM
Kim:

What version of SharePoint are you on? Also, you mention an error, but I don't see the details.

M.
Feb 4, 2014 at 2:44 PM
I am using SP 2010.

Errors from console are below.

ReferenceError: L_Menu_BaseUrl is not defined
TypeError: $(...).SPServices is undefined

Let me know if you require anything else or have any other suggestions, thank Kim
Coordinator
Feb 4, 2014 at 2:48 PM
Yeah, that damn L_Menu_BaseUrl bug. It's not you; it's me.

Here's a quick fix for 2013.02a:

Replace line 3678:
  this.thisSite = L_Menu_BaseUrl;
with:
  this.thisSite = (typeof L_Menu_BaseUrl !== "undefined") ? L_Menu_BaseUrl : "";
Or, if you're comfortable with it, use the latest alpha for 2014.01. It's got that fix plus several others. It ought to be solid, and I'm going to release it soon.

M.
Feb 4, 2014 at 2:55 PM
Thanks Marc

It appears that the link for the latest alpha is not available for download.
Coordinator
Feb 4, 2014 at 3:06 PM
Feb 4, 2014 at 3:36 PM
Thanks Mark - That seemed to do the trick. The drop downs are working as expected. I am however still getting one error in the console.

https://xxxx/xxxx/xxxx/xxxx/job-profiles/_vti_bin/Lists.asmx 500 (Internal Server Error)



This doesn't seem to be affecting the drop downs so I am not sure this is something I need to be worried about. I can navigate the url and I don't receive any errors.

Other than that it appears it is working for me know.Thanks for your help.
Coordinator
Feb 4, 2014 at 3:51 PM
Hmm. That's not good. Can you copy out the SOAP data that's being sent in that call and post it here?

M.
Feb 4, 2014 at 4:51 PM
Edited Feb 4, 2014 at 4:59 PM
You might have to walk me through this if you don't mind. I am still fairly new at this.
Feb 6, 2014 at 3:39 PM
Hi Mark - Here is the information you requested. I hope this is what you were looking for.



`` <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring><detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">
List does not exist.
The page you selected contains a list that does not exist.  It may have been deleted by another user.
</errorstring><errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x82000006</errorcode></detail></soap:Fault></soap:Body></soap:Envelope>
```
Coordinator
Feb 6, 2014 at 3:47 PM
Well, that error is pretty self explanatory. The list you've made a call to get info from doesn't exist.

In the Post tab where you grabbed this response, you should be able to see what the request actually is, along with the listName.

M.
Feb 6, 2014 at 6:03 PM
Hi Mark - Yes it's self explanitory, however the list does exist. It is the first list called departments that uses title for the information. I have 3 lists, is there something i am doing wrong?

$().SPServices.SPCascadeDropdowns({
    relationshipWebURL: "/",
    relationshipList: "Divisions",
    relationshipListParentColumn: "Department",
    relationshipListChildColumn: "Title",
    relationshipListSortColumn: "ID",
    parentColumn: "Departments",
    childColumn: "Divisions",
    debug: true
    });

    $().SPServices.SPCascadeDropdowns({
    relationshipWebURL: "/",
    relationshipList: "Sections",
    relationshipListParentColumn: "Division",
    relationshipListChildColumn: "Title",
    relationshipListSortColumn: "ID",
    parentColumn: "Divisions",
    childColumn: "Sections",
    debug: true
    });

});
Coordinator
Feb 7, 2014 at 3:42 AM
Can you tell from the Net traffic which request is causing the error? If so, can you post the info from the Post tab? That should tell us what the call is that is causing the error.

M.
Sep 29, 2014 at 7:53 AM
Edited Sep 29, 2014 at 8:34 AM
Sorry is this post is not the correct place, but i have the same problem with SPCascadeDropdowns and i think this post is not answered.

I have two list with a lookup column, when i put the code in newform.aspx of a random list with the two lookup columns, it works perfectly, but when i put (the same code) in a custom application page located in _layouts, newdocset.aspx it doesn't works.

The error is the same at this post, list name is empty in one called of Lists.asmx.
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetList xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName></listName>
</GetList>
</soap:Body>
</soap:Envelope>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring>
<detail>
<errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/"> List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user. </errorstring>
<errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x82000006</errorcode>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I tried with the new alpha released SPServices-2014.02ALPHA3.js and the same error is shown.

Can anyone help me? thanxs
Coordinator
Oct 6, 2014 at 5:51 PM
FabianDa:

I think the issue is that the context is different for a _layouts page. It doesn't sit in a Web per se, and the logic I use to determine the current context probably is failing.

M.
Nov 4, 2014 at 11:25 AM
Hi there

I'm getting the same or a similar issue on a SharePoint 2010 site. It is working OK in IE8 and IE9 but not in IE10, IE11 or Chrome38.

Current libraries are: jquery.spservices-0.5.4.min.js, jquery-1.10.1.min.js

There is a button in the ribbon which does a preliminary GetListItems call to see if a flag has been set on the selected item, including this call:
function notLocked(S1) {
    var permittedIntervention = 0;
    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "Projects",
        CAMLViewFields: "<ViewFields><FieldRef Name='PermittedIntervention' /></ViewFields>",
        CAMLQuery: "<Query><Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + S1 + "</Value></Eq></Where></Query>",
        completefunc: function (xData, Status) {
            $(xData.responseXML).find("z\\:row").each(function () {
                permittedIntervention = $(this).attr('ows_PermittedIntervention')
            });
        }
    });
    //1 for permitted, 0 for locked
    return permittedIntervention;
}
As I say this works fine in IE8 and IE9. In IE10, IE11, Chrome38, on the same item, I get a response like:
"soap:ServerException of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.\n    List does not exist.\n    The page you selected contains a list that does not exist.  It may have been deleted by another user.\n    0x82000006"
The result is therefore a returned 0 instead of a 1, when a 1 is expected.

I'll do some further investigation and post back what I can find. There seem to be some similar issues 'out there' which seem to relate to GetListItems.
Nov 4, 2014 at 11:31 AM
Edited Nov 4, 2014 at 12:39 PM
I guess it may be a good start if I deployed an up-to-date version of SPServices <f/x>blushes... OK done that... problem persists with SPServices-2014.01.min.js.

Will let you know if I turn up a solution