SPServices.SPCascadeDropDowns not working

Apr 24, 2012 at 5:39 PM

I cannot get the dropdown for country to filter by country. Here is my code for CEWP for sharepoint 2007. I have created 3 custom lists. One for Regions, this has the column title that holds the regions. Then I have a custom list for countries. this has the column title and region. The title holds the names of the countries and the region column shows the region that the country is in. The third custom list is the form that pulls it all together. It has the region column set to lookup where it pulls up the options to choose a region from the regions list. Then it has a another look up column for country. This is currently pulling through all the countries. I want it to pull up the countries within the region, not all of them. It looks like it is not accepting the filter from SPServices. What am I doing wrong? I have put the CEWP with the script on both the allItems page and also the newforms page and neither one makes the countries filter.

<script type="text/javascript" src="........ConnectCCB/SarahWork/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="......../jquery.SPServices-0.7.1a.min.js"></script>


<script language="javascript" type="text/javascript">
$(document).ready(function() {
 // Set up the cascade from Region to State
 $().SPServices.SPCascadeDropdowns({
  relationshipList: "Countries",
  relationshipListParentColumn: "Region",
  relationshipListChildColumn: "Title",
  relationshipListSortColumn: "Region",
  parentColumn: "Region",
  childColumn: "Country"
                debug: true
 });

});
</script>
 
CAMLQuery: "<Eq><FieldRef Name='Status'/><Value Type='Text'>Active</Value></Eq>"

 

I am wondering what is causing it not to work. It is either the way I have my custom list columns set up or it is the script. I followed your example and I could use come help on this asap. Thanks for your hard work on this.

Coordinator
Apr 24, 2012 at 5:44 PM

I thikn you have the parent/child relationship backwards. Regions are in Countries, not the other way around.

M.

Apr 24, 2012 at 5:45 PM

This is for a global project where we have global regions of the world, so I want them to first select their global region, then tell me what country they work in

Apr 24, 2012 at 5:49 PM

The list that holds the countries have the columns set up as follows:

Title                                       Region

United States                          North America

Korea                                     Asia

Mexico                                   LATAM

Apr 24, 2012 at 5:54 PM

The list that holds the region is as follows;

Title

Asia

EMEA

LATAM

North America

Apr 24, 2012 at 5:57 PM

The final list shows the following fields

Region       Asia (this is the dropdown list) this is currently pulling from this list region and shows the four options - I want to select a region and then it will filter for the choices in that region

Country     Korea(this is the dropdown list) It currently pulls all the countries from the country list. I want this to filter based on the region I choose. I hope this helps explain what I am doing. I would love to make this work!!!

Apr 24, 2012 at 6:02 PM

I switched the parent child relationships and still does not work

Apr 24, 2012 at 6:23 PM

 

Here is my revision and it still does not work

<script type="text/javascript" src="........./ConnectCCB/SarahWork/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="........./ConnectCCB/SarahWork/js/jquery.SPServices-0.7.1a.min.js"></script>


<script language="javascript" type="text/javascript">
$(document).ready(function() {
 // Set up the cascade from Region to State
 $().SPServices.SPCascadeDropdowns({
  relationshipList: "Countries",
  relationshipListParentColumn: "Region",
  relationshipListChildColumn: "Title",
  relationshipListSortColumn: "Title",
  parentColumn: "Region",
  childColumn: "Country"
                debug: true
 });

});
</script>
 
CAMLQuery: "<Eq><FieldRef Name='Status'/><Value Type='Text'>Active</Value></Eq>"

Apr 24, 2012 at 7:48 PM

I got it!!! Very cool. Thanks for sharing this with us!

Apr 24, 2012 at 11:38 PM
I'm assuming you found the missing comma between "country" and the next attribute (debug) in:

childColumn: "Country"
debug: true


_____
Paul

Sent from mobile device.

Apr 25, 2012 at 3:30 PM

Yes, once I added the comma, it worked great!! Thanks