This project is read-only.
How to configure

1. Upload js file (SolidQ-SPS-JS.js) to SharePoint (for example in Style Library)

2. Edit EditForm.aspx page in Documents Library (if you want apply cascade lookup to Documents library)
EditForm.png

2. In EditForm.aspx page you can add (in PlaceHolderAdditionalPageHead ContentPlaceHolder) this code:
<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
<SharePoint:scriptlink ID="ScriptLink" Name="SP.js" runat="server" OnDemand="true" Localizable="false"></SharePoint:ScriptLink>
<script type="text/javascript" src="/Style%20Library/SolidQ-SPS-JS.js"></script>

<script type="text/javascript">
var clientListId = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX';
var projectsListId = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX';
var subprojectListId = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX';

ExecuteOrDelayUntilScriptLoaded(InitCascade, "sp.js");
function InitCascade()
{
cli = new SolidQLookupField(clientListId,'Client');
pro = new SolidQLookupField(projectsListId,'Project');
subpro = new SolidQLookupField(subprojectListId,'SubProject');

var rel = new SolidQCascadeRelationShip(cli,pro,'ClientLookup');
var rel2 = new SolidQCascadeRelationShip(pro,subpro,'ProjectLookup');

}

</script>
...
</asp:Content>


Considerations
- I assume that Lookup Columns in Documents library was named: "Client, Project and SubProject" in all languages (MUI).
- I also assume that Lookup Column in Project List has Static Name: "ClientLookup", and Lookup column in SubProject list has static name "ProjectLookup".
- You can get all list ID with PowerShell: $web = Get-SPWeb(http://oursite); $web.Lists | format-table title,id;


Regards!

Last edited May 7, 2012 at 7:43 PM by jquinto, version 3

Comments

NathanJJJ81 Aug 15, 2013 at 9:23 PM 
Hi I have a few questions.

Do the fields I look to, to supply information for my drop downs have to be lookup fields?
Do I need to create multiple lists, so that each list houses one column? Or can I create one list and have all my information point to that?

lpdowdell Jul 4, 2013 at 5:42 PM 
this code is so hard to understand.
could you provide a concise example with pictures and explaining the major components that need to be tailored for the specific examples?

lpdowdell Jul 4, 2013 at 5:28 PM 
do I have to type this line literally as is with "SP.js" what is SP.js?

<SharePoint:scriptlink ID="ScriptLink" Name="SP.js" runat="server" OnDemand="true"

Sharepointnewbie4 Sep 19, 2012 at 12:20 PM 
Nice article... What's the possibility of setting a lookup default value with your code.

Thanks,
AJ

harryteguh Sep 12, 2012 at 3:23 PM 
Hi,

I'm a newbie on SharePoint would need your help. I hope I can explain this clearly...

I'm designing a cascade dropdown list and followed the tutorial based on your work (thank you, btw :) and so far, it works quite well except for one flaw

Everytime I chose a specific options on the parent list, the option on the child list is not filtered perfectly. For example, If I chose "Option A" on the DocCat list (the parent list), the options in the CCCode list (the child list) should be filtered. And if I chose "Option B" on the DocCat list, the RelationCode list (as the sibling of CCCode list) should be filtered. But they didn't. Either lists are filtered properly only after I chose the corresponding parent list and mash the Save button.

How do I filter the lists properly without pressing the save button first? Is there smething I'm missing? Please help...


Best regards
Harry

Here is the code. Some changes were made for adjustment

<script type="text/javascript" src="https://TheSiteFarm/Scripts/SolidQ-SPS-JS.js"></script>;





<script type="text/javascript">

var DocTypeId = '{4714DFC5-B2CB-467B-A2C5-4264C2E69MC0}';

var DocCatId = '{563BF4B7-5Y75-42D1-B151-D132F953BDB8}';

var DCodeID = '{85030694-D555-4805-9DEB-4D385883128F}';

var CCCodeID = '{B01BCA17-1863-427B-D715-30D556637F06}';

var RelationID = '{B15C87F4-4118-4EF1-827E-818DV3AM9441}';





ExecuteOrDelayUntilScriptLoaded (InitCascade, "sp.js");

function InitCascade()

{

DocType = new SolidQLookupField(DocTypeId,'Document Types');

DocCat = new SolidQLookupField(DocCatId,'Document Category');

DCCode = new SolidQLookupField(DCodeID ,'DC Code');

CCCode = new SolidQLookupField(CCCodeID ,'CC Code');

RelationCode = new SolidQLookupField(Relation,'Relation Code');



var rel = new SolidQCascadeRelationShip(DocType,DocCat,'DocTypeID');

var category = rel.childField.selectedID;

var rel2 = new SolidQCascadeRelationShip(DocCat,DCCode,'Document_Category_ID');



if ((category == "1") || (category == "3")) {

alert("Official Correspondence");

var rel3 = new SolidQCascadeRelationShip(DCCode ,CCCode ,'Disc_Code_ID');

}

else if ((category == "2") || (category == "4")) {

alert("Documents");

var rel4 = new SolidQCascadeRelationShip(DCCode ,RelationCode ,'Discipline_Codes_ID');

}

else {

alert("__unrecognized__");

}

}



</script>

yoshitoshi Jul 3, 2012 at 2:19 PM 
Hello, thnx! It works nice :)

Just one small thing:
> In EditForm.aspx page you can add (in PlaceHolderAdditionalPageHead ContentPlaceHolder) this code:
> <asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
> <SharePoint:scriptlink ID="ScriptLink" Name="SP.js" runat="server" OnDemand="true" Localizable="false">

Aspx-file already contains one <asp:Content ContentPlaceHolder... > tag. And you write to add "some code" IN that tag.
So, it looks like you need to add another one line "<asp:Content ContentPlaceHolder... >" after first one.

And finally code should looks like this:

...
<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server" >

<!-- SOLIDQ FILTERED LOOKUP FROM HERE -->
<SharePoint:scriptlink ID="ScriptLink" Name="SP.js" runat="server" OnDemand="true" Localizable="false"></SharePoint:ScriptLink>
<script type="text/javascript" src="/Style%20Library/SolidQ-SPS-JS.js"></script>
<script type="text/javascript">
var clientListId = '6d822a65-d599-4752-816e-4c6147a5b59c';
var projectsListId = '02975969-9c39-48ed-b30c-fba3c88d962f';
var subprojectListId = 'a1259e40-b33c-406b-aca4-7d8832ba16f8';
ExecuteOrDelayUntilScriptLoaded(InitCascade, "sp.js");

function InitCascade() {
cli = new SolidQLookupField(clientListId, 'Client');
pro = new SolidQLookupField(projectsListId, 'Project');
subpro = new SolidQLookupField(subprojectListId, 'SubProject');
var rel = new SolidQCascadeRelationShip(cli,pro, 'ClientLookup');
var rel2 = new SolidQCascadeRelationShip(pro,subpro, 'ProjectLookup');
}
</script>
<!-- // SOLIDQ FILTERED LOOKUP TO HERE -->

<SharePoint:UIVersionedContent UIVersion="4" runat="server"><ContentTemplate>
<SharePoint:CssRegistration Name="forms.css" runat="server"/>
</ContentTemplate></SharePoint:UIVersionedContent>
</asp:Content>
...

jquinto May 4, 2012 at 11:16 AM 
Hi Naresh, Thank you for your feedback, Could you provime me the error? It must be shown in Firefox JavaScript console.

NareshNemuri Dec 20, 2011 at 10:07 AM 
Hi jquinto,

I have done what you have specified for cascading..and i did well,but my problem is the cascading dropdown is working in IE but its not working in MOZILLA...

can you please guide me out of this problem

thanks,
naresh