cascading does not work

Dec 3, 2009 at 3:02 PM

hi

i have put this code into my list:

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<table cellpadding=0 cellspacing=0 id="onetIDListForm">

<script language="javascript" type="text/javascript" src="/documents/jquery-1.2.3.min.js"></script>
<script language="javascript" type="text/javascript" src="/documents/jquery.SPServices-0.4.5.min.js"></script>

<script language="javascript" type="text/javascript">
 $(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "Regions List",
   relationshipListParentColumn: "Country",
   relationshipListChildColumn: "Title",
   parentColumn: "Country",
   childColumn: "Region",
   debug: false
  });
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "States List",
   relationshipListParentColumn: "Region",
   relationshipListChildColumn: "State",
   relationshipListSortColumn: "ID",
   parentColumn: "Region",
   childColumn: "State"
  });
 });
</script>

however when i try to test the list the dropdown lists contain all values and do not filter. what am i doing wrong? I'm not sure how to check if my column names are correct?

Coordinator
Dec 3, 2009 at 3:45 PM

Here are a few things:

  • Move the script section above the table.
  • Add an alert into the $(document).ready(function() to see that you're referencing the script files correctly.
  • If you turn on debug mode, you will get errors if the column names aren't correct.

M.

Dec 3, 2009 at 4:06 PM

i have changed the code a bit to look like this...

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script language="javascript" type="text/javascript" src="/documents/jquery-1.2.3.min.js"></script>
<script language="javascript" type="text/javascript" src="/documents/jquery.SPServices-0.4.5.min.js"></script>

<table cellpadding=0 cellspacing=0 id="onetIDListForm">
<script language="javascript" type="text/javascript">

 $(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "Regions List",
   relationshipListParentColumn: "Country",
   relationshipListChildColumn: "Title",
   parentColumn: "Country",
   childColumn: "Region",
   debug: true
  });
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "States List",
   relationshipListParentColumn: "Region",
   relationshipListChildColumn: "State",
   relationshipListSortColumn: "ID",
   parentColumn: "Region",
   childColumn: "State"
  });
 });
</script>

and i am not sure how to add an alert or how to view debug messages. and my drop down lists are still not filtering. all data still appears :(

Coordinator
Dec 3, 2009 at 4:12 PM

You still need to move the larger script block above the table.

You already have enabled debug mode in the first call to SPCascadeDropdowns by setting debug: true.  If there's a problem, then a message box will pop up.

The alert would look something like this: alert("Hi, pinky2009!"); and you would put it immediately below the $(document).ready(function() { line.  If the alert pops up, then you know that the jQuery library is referenced correctly.

M.

Dec 4, 2009 at 8:28 AM

i have corrected the code and i do get debug messages as my column names are not correct. how can i correct these? :S many thanks for your help.

Coordinator
Dec 4, 2009 at 3:07 PM

The two columns relationshipList and relationshipListParentColumn need to be the StaticName of the column.  These are the underlying column names which never change, no matter how many times you might rename them.  You can see this name by going into the List Settings and clicking on one of the columns. The StaticName will be on the URL, but may be encoded.

The two columns parentColumn and childColumn need to be the DisplayNames, which are the names that you've actually see on the form.

Here are a few examples:

  • CountryName: The Display name is CountryName, the StaticName is CountryName
  • Country Name: The Display name is Country Name, the StaticName is Country_x0020_Name

    M.

  • Dec 8, 2009 at 3:03 PM

    i still can't get the column names right!!! :( i have tried everything and it just doesn't seem to work. i keep getting the message that parentcolumn is not found on the page. please help!

    Coordinator
    Dec 8, 2009 at 3:07 PM

    Deep breaths!

    Can you shoot me a screenshot? marc dot anderson [at] sympraxisconsulting dotcom.

    M.