This project has moved. For the latest updates, please go here.

SPCascadeDropdowns: Can this be used in a publishing page layout?

Feb 22, 2013 at 1:39 PM

I have successfully implemented the SPCascadeDropdowns script within the NewForm.aspx page of a list but I've been unsuccessful implementing this within a page layout content type. I have added the "Countries" and "Regions" lists at the root site level. I have then created a root site content type that has two lookup columns ("Country" and "Region") pointing at these two lists. I have configured your script correctly as it works if I create a custom list with these columns, however, when I create a publishing page based on the content type with the two lookup columns added to it, the child drop down doesn't filter when initially creating the page or editting the page?

Feb 22, 2013 at 3:59 PM

The function looks for specific markup in the page, and the markup in your page layout undoubtedly doesn't match that. If you look into the SPServices code as the DropdownCtl function, you can see what it is looking for and try to replicate it.

However, I really built the function for forms. Since you have full control over what's going on in your page layout, it may be simpler to bang together your own version of the functionality with the underlying Web Services operations.

Feb 26, 2013 at 3:34 PM
Edited Feb 27, 2013 at 8:02 AM
Thanks for your reply.

From using firebug I can see that the markup is different:


<select title="News Category" id="ctl00_m_g_0099c24b_b604_4940_92b8_8842ee19ec7f_ctl00_ctl05_ctl03_ctl00_ctl00_ctl04_ctl00_Lookup" name="ctl00$m$g_0099c24b_b604_4940_92b8_8842ee19ec7f$ctl00$ctl05$ctl03$ctl00$ctl00$ctl04$ctl00$Lookup">
                    <option value="0" selected="selected">(None)</option>
                    <option value="1">Corporate News</option>
                    <option value="2">Industry News</option>
                    <option value="3">My News</option>

<select style="width:143px;height:125px;overflow:scroll;" ondblclick="GipAddSelectedItems(ctl00_m_g_0099c24b_b604_4940_92b8_8842ee19ec7f_ctl00_ctl05_ctl04_ctl00_ctl00_ctl04_ctl00_ctl00_MultiLookupPicker_m); return false" onchange="GipSelectCandidateItems(ctl00_m_g_0099c24b_b604_4940_92b8_8842ee19ec7f_ctl00_ctl05_ctl04_ctl00_ctl00_ctl04_ctl00_ctl00_MultiLookupPicker_m);" title="News Sub Category possible values" multiple="multiple" id="ctl00_m_g_0099c24b_b604_4940_92b8_8842ee19ec7f_ctl00_ctl05_ctl04_ctl00_ctl00_ctl04_ctl00_ctl00_SelectCandidate" name="ctl00$m$g_0099c24b_b604_4940_92b8_8842ee19ec7f$ctl00$ctl05$ctl04$ctl00$ctl00$ctl04$ctl00$ctl00$SelectCandidate">
                <option value="1">Nutrition</option></select>
Page Layout Content Type...

<select title="News Category" id="ctl00_PlaceHolderMain_LookupField1_Lookup" name="ctl00$PlaceHolderMain$LookupField1$Lookup">
    <option value="1">Corporate News</option>
    <option value="2" selected="selected">Industry News</option>
    <option value="3">My News</option>

<select style="width:143px;height:125px;overflow:scroll;" ondblclick="GipAddSelectedItems(ctl00_PlaceHolderMain_ctl04_ctl00_MultiLookupPicker_m); return false" onchange="GipSelectCandidateItems(ctl00_PlaceHolderMain_ctl04_ctl00_MultiLookupPicker_m);" title="News Sub Category possible values" multiple="multiple" id="ctl00_PlaceHolderMain_ctl04_ctl00_SelectCandidate" name="ctl00$PlaceHolderMain$ctl04$ctl00$SelectCandidate">
<option value="2" title="Liverpool">Liverpool</option></select>
From the above it just seems to be the PARENT of the page layout content type that isn't picking up the correct markup. However, from looking at your SPServices code I can't see anything obvious to tell me my the markup isn't being built correctly.

Any further help appreciated.