Cascading dropdown in SP2013 - child items not showing

Dec 6, 2013 at 3:08 PM
I have the same scenario as the author of this discussion: https://spservices.codeplex.com/discussions/471893. I have the following script in a CEWP on the newform.aspx of MyList.

<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.10.2.min.js"></script>
<script type="text/javascript" language="javascript" src="/Style%20Library/Scripts/jquery.SPServices-2013.01.js"></script>
<script type="text/javascript"> $(document).ready(function() { $().SPServices.SPCascadeDropdowns({ listName: "MyList", relationshipList: "Regions", relationshipListParentColumn: "Country", relationshipListChildColumn: "Title", parentColumn: "Country", childColumn: "Region", debug: true }); }); </script> Regions is a list containing two fields, Country which is a lookup to the Countries list, and Title which is the name of the region. MyList contains two lookup fields to the fields Country and Title in the Regions list. My first dropdown displays the countries, but my second one never displays any regions at all, no matter what I choose in the country field. When debugging in Firefox, I noticed that xData in the method below throws the error "[Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.10.2.min.js :: .send :: line 6" data: no]"

// Get information about the childColumn from the current list
$().SPServices({
operation: "GetList",
async: false,
cacheXML: true,
listName: opt.listName,
completefunc: function(xData) {
$(xData.responseXML).find("Fields").each(function() {
$(this).find("Field[DisplayName='" + opt.childColumn + "']").each(function() {
// Determine whether childColumn is Required
childColumnRequired = ($(this).attr("Required") === "TRUE") ? true : false;
childColumnStatic = $(this).attr("StaticName");
// Stop looking; we're done
return false;
});
});
}
});

Any ideas on what to do?

Thank you!
Helena
Coordinator
Dec 6, 2013 at 4:32 PM
Helena:

I think the issue may lie here "MyList contains two lookup fields to the fields Country and Title in the Regions list". MyList should look up to Countries.Title and Regions.Title.

M.
Dec 6, 2013 at 6:29 PM
Oh sorry, I was wrong in my description, I do have the setup you describe with the two lookup fields addressing the Countries and Regions list. But cannot get it to work.
Coordinator
Dec 6, 2013 at 6:56 PM
Edited Dec 6, 2013 at 6:56 PM
It's tough to read your code above, but I don't see anything else above that looks out of whack.

If your page is in the list context, try removing listName: "MyList". It's also possible that your list has a different name than you're specifying.

M.
Dec 7, 2013 at 12:00 AM
Turns out I needed to specify relationshipWebURL even though the relationshipList is in the current site. Now it works like a charm :-)
Coordinator
Dec 7, 2013 at 12:03 AM
You shouldn't need to specify it if the list is in the current Web.

M.