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

Newbie - sharepoint cascade dropdowns

Jun 15, 2012 at 4:26 AM
Edited Jun 15, 2012 at 4:40 AM

I am getting something really fundamental wrong in implementating a very basic cascading dropdown list.  The code is appearing in the implmented page when I view source, but it seems to be completely ignored, even when I try to generate a debug error by feeding it incorrect field names!

I created a copy of the Newform page which contains all the fields from this particular list, created in the sharepoint 2007 interface, and edited it in sharepoint designer.

I went down to the line:...

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

...and directly underneath that line I put the following:

<script language="javascript" type="text/javascript" src="/Scripts/jquery-1.7.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/Scripts/jquery.SPServices-0.7.1a.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {

       // Set up the cascade from Customer to Phone Number
              relationshipList: "NSW Customer Accounts ",
              relationshipListParentColumn: "Customer",
              relationshipListChildColumn: "Phone Number",
              parentColumn: "Customer",
              childColumn: "Phone Number"

              debug: true



I know the libraries exist because I have tested them using ctrl+click in sharepoint designer.

I expected the Phone Number field in this list to become a dropdown or there to be some sort of error or at least bad result, but instead it does EXACTLY the same thing as the native NEWFORM.ASPX.  As per initial paragraph, if I do a view source on the page I can see all the code listed there.

The parent list has been created, and to simplify things, I have used the same names in both the parent list and this list for easy matching.

As per subject... newbie, please be gentle!  Very keen to get this working as I am eying off some other very cool functions in this libary :)




Jun 15, 2012 at 4:57 AM
I can see that you are missing a comma prior to the debug input parameter. That will cause a JavaScript exception and prevent the code from running.


Sent from mobile device.

Jun 15, 2012 at 5:21 AM
ptavares wrote:
I can see that you are missing a comma prior to the debug input parameter. That will cause a JavaScript exception and prevent the code from running. 

Awesome... not sure what else I was getting wrong prior to introducing debug, but after inserting the offending missing comma, I am now getting a spservices debug error that will at least let me move forward!  Thanks so much.


Jun 15, 2012 at 6:20 AM

Ok, kinda sorta back to square one.  I definitely know the code is firing as I can get the debug to show me errors if I put in incorrect name fields.

What I am expecting from above code (with the extra comma before debug statement), is that when I select a Customer field (which is just a lookup on the parent table) in the edited NEWFORM.ASPX that I get a selection in the phone field with just the phone number related to that customer.  What I get is the standard form layout with an editable phone number text field.

going away to try and work it out some more, but if anyone has any insight or thinks I am just getting the whole conept wrong let me know

Jun 15, 2012 at 6:50 AM
Edited Jun 15, 2012 at 7:37 AM

Ok, it was a real newbie thing.  Let this be a guideline for others... :)

I had put in the phone number field in the child list as a text field... not a selection list.  for some reason my brain seemed to expect that the function would somehow miraculously turn the text field into a selection field. 

Of course this was never going to happen, no matter how long I blinked and looked at the screen.   so I turned it into a LOOKUP field and pionted it back to the field that we are filtering, and through the magic of "you should have done that in the first place Stimpy", it all works.

the other catch for beginnners is that sometimes the field reference is not what you think it is.  If in doubt go and edit the column that is in question, look at the end of the URL and you should see if it matches your field name.  I had a case where a space was being translated into something more than I expected, so I recreated the field with an underscore instead.

Thanks for reading.  Have a froody day.