This project has moved and is read-only. For the latest updates, please go here.

Check if SPServices is being called

Oct 25, 2012 at 9:12 PM

Here is a little background on what I am trying to do...

I have created a Web Part Page in SharePoint 2007.  Added some calls to jQuery, CSS, etc.  Added a DVWP to create a new list item.

I am attempting to use SPCascadeDropdowns and I beleive that all of my settings are setup correctly.  The cascading is not happening and I have turned on the Debug mode and I am getting nothing.

Is there an easy way to see if SPServices is actually being called and to determine if the issue is with my implementation or if the problem is related to something else?

Thanks, Jim 

Oct 29, 2012 at 1:17 PM

There are two methods to check this out that I use quite frequently.  The first is to take a look at the raw xml return that is produced from the Web Service call.  The other involves using a built in SPServices function to process the raw return into something more readable.  In each case, the calls are part of your 'completefunc:' argument.  If you're successfully making a web services call, you will always get something back.  The examples follow:

Method 1:  View the raw xml data return.
    Create a <textarea> element on your page to display the raw xml return from the SPService call such as...
    <textarea rows=20 cols=150 id='xmlTextBox' />

    Make the following code your 'completefunc:' argument:

Method 2:  Format the raw xml data return into a more readable format
    Create a <div> element on your page to display the formatted results such as...
    <div id='mySPDebug' />

    Make the following code your 'completefunc' argument:
    var strRtn = $().SPServices.SPDebugXMLHttpResult({
                             node: xData.responseXML

Oct 29, 2012 at 4:06 PM

console.log(xData.responseXML.xml) and alert(xData.responseXML.xml) work too for quick tests.

Oct 29, 2012 at 5:02 PM


If you've got a customized form, then it's highly likely that the markup the form is generating isn't what SPCascadeDropdowns expects. On the other hand, if you enabled debug mode, it ought to be complaining about things.

Check out this blog post for some basic steps to ensure that everything is set up properly up front:


Oct 29, 2012 at 5:55 PM

Thanks for all of the information everybody.  I do know that jQuery and SPServices are being called thanks to Marc's post.  

Now I have to figure out a couple other things.  On my custom page the SPCascadeDropdowns is not working.  I did add it to the NewItem.aspx page to test it and it is working on that page.  So I know that my problem is not related to that code.

Time to keep working on it...

Oct 29, 2012 at 10:16 PM

I seem to recall if you are using a custom form and want to use the value added form functions from SPServices, you need to add some xsl:text fields into the page in order for the SPServices functions to find what it's looking for.

Oct 30, 2012 at 5:46 PM

@PirateEric It does look like I am going to need to find that information for my custom page although it is not vital at this point in my project.

On another note I am using the following code on the NewItem.aspx page and it is partially working.  It fills in my value for my Title but I get Undefined values for both variables.  Any ideas anybody?

function PreSaveAction() {
      var txtVendor = $("input[id*=ff4_]").val();
      var txtScope = $("input[id*=ff5_]").val();
      $("input[title=Title]").val(txtVendor + ' - ' + txtScope);
      return true;


Oct 31, 2012 at 4:50 AM


Hard to say without seeing the markup from your form. Your selectors are saying "find input element(s) with 'ff4_' in their id attribute". If there is more than one input element which matches that selector, then the val() function will return undefined.


Oct 31, 2012 at 7:21 PM

Thanks for the reply Marc.  I was able to determine what the problem was.  I was looking for values in a select and not an input.  Here is the final code that I had to use that included my additional fields that I needed as well...

function PreSaveAction() {
      var txtVendor = $("select[Title=Vendor] :selected").text();
      var txtScope = $("select[Title=ContractScope] :selected").text();
      var txtLocation = $("input[Title=ContractLocation]").val();
      var txtType = $("select[Title=ContractType] :selected").text();      
      $("input[title=Title]").val(txtVendor + ' - ' + txtScope + ' - ' + txtLocation + ' - ' + txtType);
      return true;