CascadingDropDown..SooooClose

Dec 9, 2009 at 7:48 PM
Edited Dec 10, 2009 at 4:06 PM

Hi Marc,

I have spent a good 4 hrs working with your demo and its almost working, My alert pops up :), Starting out Country is None, Region has Choose Region, Start has Choose State, I pick Country USA, you see Region change and get Region options, but when I pick a Region the State option is not pulling the list of states..could almost drive a person crazy :)

Demo Page:

http://spservices.codeplex.com/wikipage?title=%24().SPServices.SPCascadeDropdowns&referringTitle=Documentation

I made exact lists for the Countries, Regions, States

Im using this code

<script language="javascript" type="text/javascript" src="../Javascript/jquery/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript" src="../Javascript/jquery/jquery.SPServices-0.4.6.min.js"></script>
<script language="javascript" type="text/javascript">
	$(document).ready(function() {
         alert("HI MARC"); 
		$().SPServices.SPCascadeDropdowns({
			relationshipList: "Regions",
			relationshipListParentColumn: "Country",
			relationshipListChildColumn: "Title",
			parentColumn: "Country",
			childColumn: "Region",
			debug: true
		});
	
$().SPServices.SPCascadeDropdowns({
			relationshipList: "States",
			relationshipListParentColumn: "Regions",
			relationshipListChildColumn: "State",
			relationshipListSortColumn: "ID",
			parentColumn: "Region",
			childColumn: "State"
                        	});



	});
</script>


Coordinator
Dec 9, 2009 at 8:04 PM
Edited Dec 9, 2009 at 8:05 PM

Is the relationshipListChildColumn in your States list actually called State or is it Title?  You probably should turn on debug mode for that call, too.

M.

Dec 10, 2009 at 12:21 PM
Edited Dec 10, 2009 at 12:42 PM

The list thats holding the state information is named States, it has 3 column's in it called State, State Abbreviation, Regions.

I enabled debug and its showing a error but I dont understand what it means, I'm not a developer just a hacker : )

 

Error in function
SPServices.SPCascadeDropdowns
Parameter
relationshipListParentColumn: Regions or 
relationshipListChildColumn: State
Message
Not fount in relationshipList States

 

 

One of my issues is I dont understand the difference between a Child Column and Parent

 

Dec 10, 2009 at 12:34 PM
Edited Dec 10, 2009 at 1:29 PM

Just an FYI, not getting email on your reply :)

 

 

Dec 10, 2009 at 12:40 PM
Edited Dec 10, 2009 at 4:32 PM

Just hacking around got the debug message to change

 

ERROR IN FUNCTION
SPServices.SPCascadeDropdowns
PARAMETER
childColumn: Regions
MESSAGE
Column not found on page
<script language="javascript" type="text/javascript" src="../Javascript/jquery/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript" src="../Javascript/jquery/jquery.SPServices-0.4.6.min.js"></script>
<script language="javascript" type="text/javascript">
	$(document).ready(function() {
          
		$().SPServices.SPCascadeDropdowns({
			relationshipList: "Regions",
			relationshipListParentColumn: "Country",
			relationshipListChildColumn: "Title",
			parentColumn: "Country",
			childColumn: "Region",
			debug: true
		});
	
$().SPServices.SPCascadeDropdowns({
			relationshipList: "States",
			relationshipListParentColumn: "State",
			relationshipListChildColumn: "Regions",
			relationshipListSortColumn: "ID",
			parentColumn: "State",
			childColumn: "Regions",
                        debug: true
               	});

	});
</script>

 

 

Coordinator
Dec 10, 2009 at 1:19 PM

If you start out as a hacker, before long you'll be finding that you're a developer.  :+)

The parent column is the column which you want to trigger a change and the child column is the column which will be filtered.  So countries have regions and Country is the parent, Region is the child.

Here's what the messages are telling you:

Error in function
SPServices.SPCascadeDropdowns
Parameter
relationshipListParentColumn: Regions or
relationshipListChildColumn: State
Message
Not found in relationshipList States

This one is saying that either Regions or State is not a valid StaticName for a column in the States list. (See the Glossary link for more info.)  My guess is that relationshipListChildColumn should be Title?

ERROR IN FUNCTION
SPServices.SPCascadeDropdowns
PARAMETER
childColumn: Regions
MESSAGE
Column not found on page

This one is saying that you don't have a column called Regions on the page.  Maybe it should be Region?

M.

Dec 10, 2009 at 1:50 PM

Look forward to that day when I understand what Im hacking :)

I think this all has to do with the StaticName, when I follow your direction on how to get the StaticName

all I see are abunch of numbers that dont mean anything to me is that whatI put in for the StaticName?

I have a screen shot here

http://www.flickr.com/photos/huntertx/sets/72157622848899679/

Coordinator
Dec 10, 2009 at 2:10 PM
Edited Dec 10, 2009 at 2:51 PM

You need to click on the column name link in the relationshipLists and then look at the end of the URL in the Address Bar on that next page.  What your arrow is pointing to is the list's GUID, and you are looking at the "host" list, not one of the relationshipLists (Regions or States).

It looks like your site was an upgraded one from SharePoint 2003.  How did that process go?

M.

Dec 10, 2009 at 2:43 PM
Edited Dec 10, 2009 at 4:05 PM

Our upgrade was very smooth, just a few hrs of down time, our IT guys did a great job with that one.  No word on when or even if we are going to 2010, my guess is we wont for some time.

 Ok I *think* I got the StaticName and I no longer get debug popups :) but Im still seeing a problem..

after picking the Region, the State pull down has all the options from the States list not just the ones defined to the region

 

Is this the StaticName?

http://www.flickr.com/photos/huntertx/4173809577

This is the current code

 

<script language="javascript" type="text/javascript" src="../Javascript/jquery/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript" src="../Javascript/jquery/jquery.SPServices-0.4.6.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {

$().SPServices.SPCascadeDropdowns({
relationshipList: "Regions",
relationshipListParentColumn: "Country",
relationshipListChildColumn: "Title",
parentColumn: "Country",
childColumn: "Region",
debug: true
});

$().SPServices.SPCascadeDropdowns({
relationshipList: "States",
relationshipListParentColumn: "Title",
relationshipListChildColumn: "Regions",
relationshipListSortColumn: "ID",
parentColumn: "State",
childColumn: "Region",
debug: true
});

});
</script>

 

Coordinator
Dec 10, 2009 at 2:54 PM
Edited Dec 10, 2009 at 2:55 PM

Good to hear that the upgrade went smootly.  That's not the usual response!

Looks like you have the parent and child reversed in the second call to SPCascadeDropdowns:

$().SPServices.SPCascadeDropdowns({
  relationshipList: "States",
  relationshipListParentColumn: "Regions",
  relationshipListChildColumn: "Title",
  relationshipListSortColumn: "ID",
  parentColumn: "Region",
  childColumn: "State",
  debug: true
});

M.

Dec 10, 2009 at 3:17 PM

LOL this is making me nuts :)

when I set it the way you have it I get this..

ERROR IN FUNCTION
SPServices.SPCascadeDropdowns
PARAMETER
relationshipListParentColumn: Regions or 
relatioshipListChildColumn: Title
MESSAGE
Not found in RelationshipList: States

$().SPServices.SPCascadeDropdowns({
            relationshipList: "States",
            relationshipListParentColumn: "Regions",
            relationshipListChildColumn: "Title",
            relationshipListSortColumn: "ID",
            parentColumn: "Region",
            childColumn: "State",
                        debug: true
                   });

 

 

 

 

Dec 10, 2009 at 3:27 PM

Ok I found one issue, when I 1st built the States list I used Region Name then I went back and renamed it to Regions but when

I look at the StaticName for Regions it shows Region%5Fx0020%5FName guess renaming them in SP dont rename the Static Name (wow learning here : )

$().SPServices.SPCascadeDropdowns({
			relationshipList: "States",
			relationshipListParentColumn: "Title",
			relationshipListChildColumn: "Region%5Fx0020%5FName",
			relationshipListSortColumn: "ID",
			parentColumn: "Region",
			childColumn: "State",
                        debug: true
               	});

When it set the script like this I get no errors from debug but Im still having the problem where the State pull down is not populating.

Coordinator
Dec 10, 2009 at 3:47 PM

You've figured out the difference between StaticName and DisplayName!  When you create a column, the StaticName is set and never changes.  It also is encoded, thus the _x0020_ for a space.  In what you've posted above, you have two issues:

  • You've still got parent and child reversed
  • The Region Name encoding isn't right (I've been updating the documentation on this throughout this conversation. Let me know if it explains the StaticName better.)

$().SPServices.SPCascadeDropdowns({
  relationshipList: "States",
  relationshipListParentColumn: "Region_x0020_Name",
  relationshipListChildColumn: "Title",
  relationshipListSortColumn: "ID",
  parentColumn: "Region",
  childColumn: "State",
  debug: true
});

M.

Dec 10, 2009 at 4:04 PM

BINGO :) All working now!  And I understand it {Yikes}

Yes the updated documentation is very clear to me much more than it was before :)

Thanks Marc and thanks for the great code!

~ Patrik

 

 

Coordinator
Dec 10, 2009 at 4:22 PM

Great! Never a good idea to write code you don't understand, IMHO.

Let me know if there's anything else I can help with.

M.