SPCascadeDropdowns + Site Template + Lookup columns = :(

Oct 21, 2013 at 10:01 PM
Edited Oct 21, 2013 at 10:04 PM
Hello all,

I'm trying to use SPServices to add cascading column functionality to a SharePoint 2013 document library's EditForm.aspx page.

The end goal is to be able to add metadata to a document upon upload; however, some of the metadata fields need to be cascading (Field 1=Process Phase; Field 2=Phase Steps).

From there, I would like to package this site as a site template, so that any site created from this template will be preconfigured with cascading columns.

I've gotten this to work just fine in the 1 document library, but when I bundle as a template and test a site created from this template, it doesn't work.

More specifically, I think the cascading columns are losing their lookup values. And SharePoint being... well, SharePoint, it doesn't allow you to modify a lookup column's value after the column has been created, so I can't just fix the missing lookup reference.

Is this to be expected? I just want cascading columns in a Document Library EditForm.aspx page... is there an alternative way to inject this functionality?

Please let me know if more info is needed.
Oct 22, 2013 at 12:15 AM
Can you show your code? If you're using relative URLs and the right column names, it should work.

Oct 22, 2013 at 3:51 AM
Here's the code that I'm embedding via Content Editor Web Part.
I understand that the CEWP not the best method to inject the code, but referencing the code in the masterpage is not an ideal solution for me.
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="/SiteAssets/jquery.SPServices-2013.01/jquery.SPServices-2013.01.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
            relationshipList: "{4DE20474-4706-4DEC-9FD0-552B317247F1}",
            relationshipListParentColumn: "Phases",
            relationshipListChildColumn: "Title",
            parentColumn: "Phase",
            childColumn: "PhaseItems",
            debug: true
Oct 22, 2013 at 4:10 AM
I'd suggest using the Content Link in the CEWP to point to a file in a Document Library.

Does the code end up in the site when you hydrate the template?

Oct 22, 2013 at 4:17 AM
I'll try switching to the Content Link method instead, then rebundle as site template and check that.

Previously as CEWP, yes the code was still available in the content editor web part in the editform.aspx page... BUT the Document Library's 2 lookup columns (the recipients of these elusive cascading powers) seem to be losing their values upon rehydration.
Oct 22, 2013 at 12:40 PM
Are you creating the list inside each new site or is it stored centrally?

Oct 22, 2013 at 1:03 PM

Originally the lists were INSIDE the site template…

But then I thought about it, and decided to reference the lists stored at the root web “/”… That way maintenance etc is less of a nightmare.

Oct 22, 2013 at 1:50 PM
Indeed. If the list is inside the template, than you can't use the GUID for listName, you'd have to use the list's name, like "Announcements".

Oct 29, 2013 at 1:22 PM
spcascade.org uses SPServices to provide best free solution which support multi level dropdown list with no limits.
It is javascript/jquery based solution with no page refreshes and involves only one look up list for multiple columns.
Saves data in single line text instead of Ids that are used by typical look up columns.
Very easy to use syntax too!
    destListColTitles: ['Continent','Country','State','City'], 
    srcListColInternalNames: ['Continent','Country','State','Title'],
    srcListName: 'CitiesLookupList',
    srcListFilterCAMLQuery: "<Query><Where><Contains>
    <FieldRef Name='Continent'/><Value Type='Text'>America</Value>