Basic CascadingDropdowns setup

Jul 26, 2010 at 4:02 PM

Marc,

I have posted here before when I was trying to setup cascading dropdowns. I never got them working and decided to take a breather. Now I am ready to reattempt this. The hurdle I cannot get over is how to setup the relationships; what the field types are supposed to be; which are lookups and where they point.

I have put together a format below that I think will answer my questions if you can fill in the blanks.

LIST NAMES:
Countries
Regions
States
Orders – this is the list the form comes from to put it all together.

COUNTRIES:
Title                  - single line of text - contains list of countries (United States, Canada)

REGIONS
Title                  - single line of text - contains list of regions (Southeast, Western Provinces, etc)
Country            - is this a single line of txt, choice, lookup, etc?

 

STATES
State                - is this just the Title field renamed?
Region              - is this a single line of txt, choice, lookup, etc

ORDERS
Title                  - just leave this field as it defaults.
Country            - is this a single line of txt, choice, lookup, etc?
Region             - is this a single line of txt, choice, lookup, etc?
State               - is this a single line of txt, choice, lookup, etc?

Define Lookups in this manner: TABLENAME.FIELD NAME --> TABLE NAME.FIELDNAME
EXAMPLE ORDERS.COUNTRY --> COUNTIRES.TITLE

Thank you Marc.

Coordinator
Jul 28, 2010 at 12:40 AM

Brandon:

Let me try to answer your questions "inline". All of this *ought* to be clear in my documentation for SPCascadeDropdowns, but let me know what's missing.

LIST NAMES:
Countries
Regions
States
Orders – this is the list the form comes from to put it all together.

COUNTRIES:
Title                  - single line of text - contains list of countries (United States, Canada)

REGIONS
Title                  - single line of text - contains list of regions (Southeast, Western Provinces, etc)
Country            - is this a single line of txt, choice, lookup, etc? --> This should be a Lookup column to the Title column of the Countries list.

 

STATES
State                - is this just the Title field renamed?
Region              - is this a single line of txt, choice, lookup, etc --> This should be a Lookup column to the Title column of the Regions list.

ORDERS
Title                  - just leave this field as it defaults.
Country            - is this a single line of txt, choice, lookup, etc? --> This should be a Lookup column to the Title column of the Countries list.
Region             - is this a single line of txt, choice, lookup, etc? --> This should be a Lookup column to the Title column of the Regions list.
State               - is this a single line of txt, choice, lookup, etc? --> This should be a Lookup column to the Title column of the States list. Even though you've renamed the Title column to State, the StaticName for the column is still State.

M.

Jul 28, 2010 at 6:55 PM

Still not working, but I added an alert to my code and it is not firing.

I have the following structure:

http://IPADDRESS/SITENAME
   jQuery
         jquery.SPServices-0.5.6.js
         jquery.SPServices-0.5.6.min.js

   Lists
         "LISTNAME"
                   NewFormCustom.aspx

 

Within NewFormCustom.aspx, I have the following code:

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script language="javascript" type="text/javascript" src="../../jQuery/jquery.SPServices-0.5.6.js"></script>
<script language="javascript" type="text/javascript" src="../../jQuery/jquery.SPServices-0.5.6.min.js"></script>
<script language="javascript" type="text/javascript">
  $(document).ready(function() {
  alert(test);
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "Regions",
   relationshipListParentColumn: "Country",
   relationshipListChildColumn: "Title",
   parentColumn: "Country",
   childColumn: "Region",
   debug: true
  });
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "States",
   relationshipListParentColumn: "Region",
   relationshipListChildColumn: "Title",
   relationshipListSortColumn: "ID",
   parentColumn: "Region",
   childColumn: "State"
  });
 });
</script>

Can you spot why it seems to be ignoring the jquery code?

 

Coordinator
Jul 28, 2010 at 7:01 PM

Sure can! You're referencing the minified and uncompressed versions of SPServices but not the jQuery library itself.

Take a look at the top of this page for what you should be doing:
http://spservices.codeplex.com/documentation

M.

p.s. If I had a nickel for every time that someone did this...

Jul 28, 2010 at 8:07 PM

Okay...now we are getting somewhere! And thank's for the "p.s." It's good to know I'm not the only "D-" student here. :)

Now that I have setup my JQuery Library correctly, my alert is working nicely, however, my drop-downs still are not. The page loads, and recieve my popup that says "ready".

Country, Region and State all display "(None)" by default...and all three contain ALL choices. None are filtered based upon the parent/child relationships. Below is my code. The lists and lookups are setup exactly as you described before.

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script language="javascript" type="text/javascript" src="../../jQuery%20Libraries/jquery.SPServices-0.5.6.js"></script>
<script language="javascript" type="text/javascript" src="../../jQuery%20Libraries/jquery-1.4.2.min.js"></script>
<script language="javascript" type="text/javascript">
   $(document).ready(function() {
    alert("ready");
  
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "Regions",
   relationshipListParentColumn: "Country",
   relationshipListChildColumn: "Title",
   parentColumn: "Country",
   childColumn: "Region",
   debug: true
  });
  
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "States",
   relationshipListParentColumn: "Region",
   relationshipListChildColumn: "Title",
   relationshipListSortColumn: "ID",
   parentColumn: "Region",
   childColumn: "State"
  });
 });
</script>
 

Coordinator
Jul 28, 2010 at 8:14 PM

You've got the two libraries referenced backwards.  ;+)

M.

Jul 28, 2010 at 8:18 PM

Thank you, thank you, thank you....a MILLION times thank you! THAT fixed it.

FYI, your example located near the bottom of http://spservices.codeplex.com/wikipage?title=%24%28%29.SPServices.SPCascadeDropdowns&referringTitle=Documentation also has them backwards. That is where I copied mine from.

Hallelujah!

 

Coordinator
Jul 29, 2010 at 2:25 AM

Great! See, not so hard once you get the right bots and pieces together. ;+

Hmm. On that page, I see this, which is "forward":

<script language="javascript" type="text/javascript" src="../../jQuery%20Libraries/jquery-1.3.2.js"></script>
<script language="javascript" type="text/javascript" src="../../jQuery%20Libraries/jquery.SPServices-0.4.5.min.js"></script>

However, I just updated it to the recent versions of both libraries to avoid confusion.

M.