Using SPServices.SPCascadeDropdowns across Site Collections

Jun 26, 2010 at 7:57 AM
Edited Jun 26, 2010 at 9:14 AM

Hi Marc,

Very good concept...!!!
And it worked great too when everything was in the same Site Collection.
But my problem is, the relationshipList is in a different Site Collection (say Admin for instance). So I assigned "/sites/admin" to relationshipWebURL and used a local dummy Regions list for the sake of lookup. So this works fine while loading/changing the dropdowns but fails while saving the changes throwing "Invalid postback or callback argument" ArgumentException if your local Lookup list is not EXACTLY same as that of the relationshipList i.e. if you select a Region which is in relationshipList but not in the local Regions list.
As you said, the childColumn must be a Lookup on the relationshipList list, which means the relationshipList must be in the same site collection becuase in SharePoint we cannot Lookup on a list which is in a different Site Collection. Which means this whole setup (the client Doc Lib and the relationshipList) must be in the same Site Collection.
So what are the options I have if my relationshipList and the client Doc Lib (where I am using the cascading columns) are in the different Site Collection?

Edit:

Ok, Finally I got it to work across site collections... :)

Simple changes I made are:-

1. Set relationshipWebURL: "/sites/admin" (this is where the relationshipList exists)

2. Since I can't use Lookup columns based on a masterlist which is in another Site Collection (shame on MSFT :o)), I am just using the "Choice" column for "childColumn" in the destination Document Library. All I have to make sure that this choice column has ALL possible values/options which are in the "relationshipList" otherwise SharePoint throws "Invalid postback or callback argument" while updating the item property :). This Postback validation from ASP.Net framework is kind of annoying because the selected value in the child column at the time of postback MUST be one of those originally loaded in the dropdown, that's why we have to make sure that initially the child dropdown loads with all possible values from the "relationshipList".

3. Since I am not using Lookup (where value is usually ID) and am using normal choice column (where value is usually same as the display text) for childColumn, I just changed a line in the script as below:-

childSelect.Obj.append("<option" + selected + " value='" + thisOptionId + "'>" + thisOptionValue + "</option>");

changed to

childSelect.Obj.append("<option" + selected + " value='" + thisOptionValue + "'>" + thisOptionValue + "</option>");

All in all, I am really impressed with this script :) :) :).

So finally, a quick Q, how do we convert the "normal" script version to the "mini" version...??? Is there any "script" to minimize this jquery.SPServices.js script? :) :)

Or do we just "find and remove all" the newline characters??? :) :) :)

By the way,

I really wish, if ppl like you would be on the SharePoint product development team in MSFT, SharePoint would have been much better that what it already is :) :).

Coordinator
Jun 27, 2010 at 1:25 AM

pankajdarure:

Great that you got things working!  I think you are going to have some issues over time with this sort of manual synching process, but it's your process, not mine. ;+)

Take a look at this blog post for details on how I minify my scripts:
http://sympmarc.com/2010/05/21/the-javascript-compressorrater/

M.