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

SPCascadeDropdowns not working

Dec 15, 2015 at 8:29 PM
I'm trying to get the cascading dropdowns to work on my sharepoint 2010 form when a user is added a new document to the library. I'm not getting any errors, but my 2nd drop down is not even loading when the form loads. I've followed several blogs online that's covering this and no luck. However, I did see something that if there is more then 20 values that it won't work, is that a true statement? Both of my drop downs have over 200 items in them.

my code:
<script language="javascript" type="text/javascript">
 $(document).ready(function() {
                relationshipList: "Sales Contracts",
                relationshipListParentColumn: "SalesPerson",
                relationshipListChildColumn: "SalesContracts",
                parentColumn: "SalesPerson",
                childColumn: "SalesContracts",
                promptText: "Choose Sales person...",
                debug: true

am I missing something?
Dec 15, 2015 at 8:39 PM
SPServices knows how to handle 20+ items, as noted in the docs, so that's not the issue.

Is the column you're trying to filter on a User or Group column? The function isn't built to handle that.

Dec 16, 2015 at 12:21 PM
Edited Dec 16, 2015 at 1:42 PM
I was able to get this working, there were multiple references to the JQuery file and SPServices JS in the master page. However, is there a way to group the second drop down so the values don't show up twice and I noticed my promptText isn't showing. The 2nd dropdown is showing blank on the first row
Dec 16, 2015 at 2:37 PM
You should check the docs and make sure your list data follows the right structure. If you have multiple items in the relationshipList, you'll see multiple values.

Dec 16, 2015 at 4:02 PM
I got this working against my test list, however, when I move the code to the EditForm.aspx for my document library it fails. I setup my test list the same way has my library with the 2 lookup columns I'm using for the dropdown cascading. Does something else have to take place for this to work for a doc library?
Dec 16, 2015 at 4:46 PM
It should work exactly the same way in your EditForm on a Document Library.

Dec 16, 2015 at 4:54 PM
hmm, its not, I copied the working code from my work newform.aspx from my test list to my document library and no luck. In the editform.aspx for the doc library there are no fields named SalesPerson or contract like there are on the newform.aspx for my list. Could that be the reason? (I'm using the OOTB forms for both and just adding the code to them for this)
Dec 16, 2015 at 5:11 PM
Well, the columns need to be available on the Document Library for this to even make sense.

Dec 16, 2015 at 5:26 PM
They are available but they do not appear on the editform.aspx of the doc library. So I had to create a new edit form for the fields to appear in the HTML code (like they do for a list editform.aspx, however, it still doesn't work for a doc library. I have it working for a list just fine, just not for a document library. is there something else I need for a doc library to get this working? I created a test doc library with the same structure as my working list and its not working for the doc library
Dec 16, 2015 at 5:54 PM
Why aren't the fields appearing in the EditForm? If you have those columns on the library, they should be there unless you did something strange.

Dec 16, 2015 at 5:57 PM
I didn't do anything with it, its the OOTB editform.aspx for the document library.
Dec 16, 2015 at 7:57 PM
I have this working on several lists ,but when it comes to any of our document libraries, nothing, and one thing that is interesting is that one of the lists I have this working on, is using 2 of the same lookup columns that one of my document libraries are using when a new document gets uploaded.
Dec 16, 2015 at 8:21 PM
There's no difference between lists and libraries when it comes to this. I really have no idea. If you're not seeing the columns on the form then you must not have added them to the library.

When you say "nothing", what do you mean? The columns aren't even on the page even when you don't include the SPServices stuff?

Dec 16, 2015 at 8:38 PM
I can see the columns on the page when I run it in the browser, if I open the page in SPD, I don't see the dropdowns in the code.

I don't know why its not working, its puzzling to me to say the least. I'm actually using this on a few lists within our sites and works well, it just doesn't like the doc libraries for whatever reason.
Dec 16, 2015 at 9:20 PM
You wouldn't see the dropdowns in the page in SPD whether it's a list or a library. It's not really all that WYSIWYG. I'm really not sure what else to suggest.

Dec 17, 2015 at 12:11 PM
me either, I'm just going to build 2 dropdowns using JQuery and populate them via CAML queries, etc.
Dec 22, 2015 at 9:58 PM
I got this working, (I don't give up that easy).

What I had to do to get this working on the editform.aspx page for a document library is.

go to list settings
form web parts
default edit form

add a content editor web part to the page.
added the code to the CEWP, however just doing that didn't resolve my issue.
I then opened the page in SPD in advance edit mode and then modified the code. Once I ran the page, it worked as expected.

So I guess instead of adding it to the page directly, add it to a CWEP first and then tweak as needed in SPD.
Dec 23, 2015 at 12:29 PM
Well, I'm glad you got it working. The SPD step is unnecessary, though. Adding correct code to the CEWP should do it.