Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: Cascading lookup - child drop-down not filtering

$
0
0
Hi,

I am pretty new to jQuery and am trying to get my head around the Cascading Lookup function.

I have this scenario in SharePoint 2010:
Single Site Collection. At TOP LEVEL there is a list of PCYC Clubs which feeds a Site Column that I use a lot (as the Site Collection is the PCYC's Intranet) PCYC = Police Citizens Youth Clubs in NSW, Australia but that's not relevant.

Further down the Site Collection I have a Site with a couple of lists. The site is to manage attendance and participation in a new State Govt. Learner Driver program.

Within that site I have a List called "Courses" and another called "Participants", and I am trying to implement the cascading lookup on the NewForm page of the Participants List.

The Courses List has a Title column (re-named Course ID) which has a unique value for each course (e.g. 2013 KTA SDC01) and a Column called "PCYC Club" which is the Site Column I mentioned before (which has a Static Name PCYC%5Fx0020%5FClub and I replaced %5F with underscores).

The Participants List also has the PCYC Club lookup using the same Site Column to get the list of clubs, and a lookup to select the Course (2013 XXX SDC XX).

What I am trying to do on the Add Item form when we add a new participant is to have the user select the PCYC Club in the first drop-down and have any Courses that are already created for that club populate the next drop-down which is a lookup to Course ID (Title) from the Courses list.

I know the calls to the jQuery library and the SPServices are working because I got error pop ups at one point when I was playing around.

Here is my script:
<script language="javascript" src="/activities/pcycbrandedprograms/safedrive/jQuery/jquery-1.10.2.min.js" type="text/javascript"></script>
<script language="javascript" src="/activities/pcycbrandedprograms/safedrive/jQuery/jquery.SPServices-2013.01.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
    relationshipList: "{1252A398-76C4-46F3-BBE8-BFD71BDCE83D}",
    relationshipListParentColumn: "PCYC_x0020_Club",
    relationshipListChildColumn: "Title",
    parentColumn: "PCYC Club",
    childColumn: "Course",
    debug: true
  });
});</script>
The list GUID above is for the Courses list, which is where I assume I need the relationship?

What happens when I place this in a CEWP at the BOTTOM of the NewForm.aspx page is that the Club lookup works as expected (ie shows all clubs from the Site Column) but the next lookup for Course is NOT FILTERED.
If I choose a Club that I KNOW has some Courses it is still not filtered. In other words it is the same as not having the script.

It has to be something I am doing wrong but I have managed to confuse myself to a headache so am hoping you can set me straight.

Cheers,
Mark

Viewing all articles
Browse latest Browse all 6517

Trending Articles