Hi Mark,
At first I thought there might be a compatibility issue between the DFWP and the SPFilterDropDown function. But I discovered that it is actually an issue with the init_fields_v2() function of spjs-utility.js, as discussed by the author on one of his blog posts. So, I removed the dependency on init_fields_v2() by refactoring the code to use the necessary jQuery functionality myself. Below is the modified code, which I tested on both the standard NewForm.aspx, and a customised ;) form.
Cheers,
Charles
At first I thought there might be a compatibility issue between the DFWP and the SPFilterDropDown function. But I discovered that it is actually an issue with the init_fields_v2() function of spjs-utility.js, as discussed by the author on one of his blog posts. So, I removed the dependency on init_fields_v2() by refactoring the code to use the necessary jQuery functionality myself. Below is the modified code, which I tested on both the standard NewForm.aspx, and a customised ;) form.
Cheers,
Charles
<script src="/javascript/jquery-1.8.3.js" type="text/javascript"></script>
<script src="/javascript/jquery.SPServices-0.7.2.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$().SPServices.SPComplexToSimpleDropdown({
columnName: "PCYC Club",
completefunc: null,
debug: true
});
var field = $("nobr:contains('PCYC Club')").closest("tr");
var itemClub = $(field).find("select");
$(itemClub).change(function(){ChangeOptions(itemClub)}); //pass the object associated with the PCYC club to the ChangeOptions function
});
function ChangeOptions(clubChapter){ //added the parameter clubChapter to receive the value passed to it when the selection for the PCYC club is changed
var clubName = $(clubChapter).val(); // get the name of the PCYC club that was selected
var myQuery = "<Eq><FieldRef Name='PCYCClubs' /><Value Type='Choice'>"+clubName+"</Value></Eq>";
$().SPServices.SPFilterDropdown({
relationshipWebURL: "",
relationshipList: "Courses",
relationshipListColumn: "Title",
relationshipListSortAscending: true, // Added in 2013.01
relationshipListSortColumn: "Title",
columnName: "Course",
listName: $().SPServices.SPListNameFromUrl(),
promptText: "",
noneText: "(None)",
CAMLQuery: myQuery,
CAMLQueryOptions: "<QueryOptions></QueryOptions>",
completefunc: null,
debug: false
});
}
</script>