Hi Charles,
thank you very much for your time with this. I have tried to use your suggested approach BUT the Course drop down still doesn't filter. I tried in Chrome as well as IE10 just to make sure it wasn't a browser issue.
My current code is below, with additional annotations for clarification (mine, not yours :).
I assumed I should also change line 9 to the display name of the PCYC Club column on the add Participant form.
Your assumptions about the columns are correct: the Course column in the Participants list is a Lookup to the "Course ID" column in the Courses list, and the PCYC Club column in both lists use the same Site Column to get the list of clubs.
I know the calls to the libraries are correct because the PCYC Club drop down does indeed change when I have the script either in a CEWP on the page, or a CEWP linked to the script in the library (I put it as a text file in the same library as the jquery etc. just for testing).
I am not averse to using SharePoint Designer to put the code on the page with a little guidance, but I figured a CEWP should work just as well as long as it is at the bottom of the page?
Thanks again
Mark
thank you very much for your time with this. I have tried to use your suggested approach BUT the Course drop down still doesn't filter. I tried in Chrome as well as IE10 just to make sure it wasn't a browser issue.
My current code is below, with additional annotations for clarification (mine, not yours :).
I assumed I should also change line 9 to the display name of the PCYC Club column on the add Participant form.
Your assumptions about the columns are correct: the Course column in the Participants list is a Lookup to the "Course ID" column in the Courses list, and the PCYC Club column in both lists use the same Site Column to get the list of clubs.
I know the calls to the libraries are correct because the PCYC Club drop down does indeed change when I have the script either in a CEWP on the page, or a CEWP linked to the script in the library (I put it as a text file in the same library as the jquery etc. just for testing).
I am not averse to using SharePoint Designer to put the code on the page with a little guidance, but I figured a CEWP should work just as well as long as it is at the bottom of the page?
<script src="http://intranet.pcycnsw.org.au/activities/pcycbrandedprograms/safedrive/jQuery/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="http://intranet.pcycnsw.org.au/activities/pcycbrandedprograms/safedrive/jQuery/jquery.SPServices-2013.01.min.js" type="text/javascript"></script>
<script src="http://intranet.pcycnsw.org.au/activities/pcycbrandedprograms/safedrive/jQuery/spjs-utility.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$().SPServices.SPComplexToSimpleDropdown({
columnName: "PCYC Club", //this is the DISPLAY name of the club lookup column in the form.
completefunc: null,
debug: true
});
var field = $("nobr:contains('PCYC Club')").closest("tr");
$(itemClub).change(function(){ChangeOptions()});
});
function ChangeOptions(){
fields = init_fields_v2();
var clubName = getFieldValue("PCYC_x0020_Club");
var myQuery = "<Eq><FieldRef Name='PCYC_x0020_Club' /><Value Type='Choice'>"+clubName+"</Value></Eq>";
$().SPServices.SPFilterDropdown({
relationshipWebURL: "",
relationshipList: "{1252A398-76C4-46F3-BBE8-BFD71BDCE83D}", // this is the Courses list GUID
relationshipListColumn: "Title", // the STATIC name of the Course ID column is Title
relationshipListSortAscending: true,
relationshipListSortColumn: "Title", // sorting on the Course Id column is fine
columnName: "Course", // DISPLAY name of the Course lookup column in the Participant list
listName: $().SPServices.SPListNameFromUrl(),
promptText: "",
noneText: "(None)",
CAMLQuery: myQuery,
CAMLQueryOptions: "<QueryOptions></QueryOptions>",
completefunc: null,
debug: false
});
}
</script>
I am sure I am just missing something but I cannot see what.Thanks again
Mark