Questions on CascadingDropdown from branleejo

Coordinator
Oct 1, 2009 at 8:33 PM

Marc: thanks for the reply. I'm new to the SharePoint product, but to this point, everything has been extremely straightforward and simple to understand. Now I'm to the point that I need some more advanced functioanality that apparently isn't available out of the box, like your cascading dropdowns. I have read, and re-read this page, but I seem to be missing how to put this all together, and I appologize for that because I'm sure it's due to my being new to the product.

I understand that you have created two Custom Lists - Regions and States.

The Regions List contains the columns: Title (Region) and Country
The States List contains the columns: State, State Abbreviation and Region

Do I have it correct that these are the only two lists that were created, and that these the only fields?

Also, I understand that the Region field in one of the tables has to be a lookup to the data in the Region field of the other table, but I'm not clear on which table contains the data and which is the lookup.

I have downloaded the two jQuery files and saved them into the specified folder on my site. Now this will be a dumb question to others, but which page are you editing with the code above. Is it the NewForm.aspx page for one of the lists?

===>

You're describing the lists correctly.  The point is to have the lists to contain the hierarchical relationships between the values to drive the cascading dropdowns.

The Regions List contains the columns: Title (Region) and Country
The States List contains the columns: State [Renamed from Title], State Abbreviation and Region [this Region is a lookup into the Regions list]

The reason to use Lookup columns is to ensure that the values in your lists are in synch. Otherwise, changes or even typos will break the relationships.  All of this is just applying good database design to SharePoint lists.

And finally, yes, in the example, I'm talking about NewForm.aspx or EditForm.aspx or any customized versions of them.

M.

 

 

Oct 2, 2009 at 3:52 PM

So if you only have two lists; Regions, which contains only Title (Region) and Country; and Sates which contains only State, State Abbreviation and Region, how do you end up with a form that contains the fileds Country, Region and State which come from two different lists? There must be a third list that I am missing that somehow pulls them all together.

Coordinator
Oct 2, 2009 at 4:37 PM

Sure.  The Regions and States lists are just lists which contain the values which are used as Lookup columns elsewhere.  Whatever list you actually care about (say Sales Opportunities or Proposals or Events) would use those two lists as the sources for its columns.  So in Sales Opportunities, you'd have a column called Region and a column called State.  Those are the columns where you actually want to see the cascading dropdown behavior.

M.

Oct 2, 2009 at 7:33 PM

Thanks for the help, but I guess I'll stop wasting your time and give up on ever making this work. It is not any fault of yours. I guess I just am not ready for this. My relationshipList that pulls from the Regions and States lists is not filtering the drop-downs. I get all of my Regions in the first drop-down, select one, and still get all States; not just the states for that Region.

My goal was to be able to create a form for our 500+ users to complete when submitting a helpdesk ticket. They could choose a Program, and beneath that program a category for their problem. Currently users just email the helpdesk email address directly, which means it's freeform, and users do not always provide enough information to get the ticket assigned to the proper techian/dept. Getting cascading dropdowns to work was step 1 in this project. Step 2 was going to be figuring out a way to get the results into an email to the helpdesk, so users could paste in a screenshot of an error if needed, but I can't get past step 1.

Sorry for the trouble. I really do appreciate the time you gave me, Marc.

Coordinator
Oct 3, 2009 at 2:44 AM

Don't give up so easily!  I'd be glad to help you work it through if you want.

M.

Oct 26, 2009 at 7:08 PM

I'd like to preface my reply by saying that I too am a complete noob.

Pardon my intrusion onto this discussion, but I think that what is missing is the actual Javascript for the Cascading Dropdown (shown in the page on that topic, I think). I too have downloaded jquery.SPServices-0.4.1.min.js and jquery-1.3.2.min.js into a folder named jQuery on the root (are these the right files?). However, where is the Javascript for the Cascading Dropdown supposed to go? Do you apply it to the page in SharePoint Designer using a DVWP (I thought I read that somewhere) or the actual form(s) where it will be used? Also, there are two areas of code on the page- one under the section labeled "Syntax," and one under the area labeled "Examples." Do these both get pasted into a DVWP?

I am sure that all of this information is clear to more seasoned users, so I appreciate your patience. I tried very hard to find these answers on the site somewhere to no avail... 

Coordinator
Oct 26, 2009 at 9:20 PM

No problems at all, Tasha.  We all started as noobs at one point.

You can put the code into the page(s) with SPD.  If you want to add the cascading to NewForm.aspx, then take a copy of the form, call it something like NewFormCustom.aspx, and add the jQuery into it.  I generally put my script in the PlaceHolderMain ContentPlaceHolder, like this:

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

Obviously, the src attributes should point to wherever you've put the .js files.

Once you've got the page set up the way you want it, right click on the list in the Folder List pane, select Properties, and then the Supporting Files tab.  Choose the Content type in the dropdown (NOT Folder) and then browse to your NewFormCustom.aspx to set it as the New Item Form.  Click OK and you should be good to go.

Hope this helps.  Let me know if you have further questions.

M.

Oct 27, 2009 at 5:01 PM
Edited Oct 27, 2009 at 5:02 PM

  Unfortunately, I do have more questions!

I got an error message (this is when you attempt to add a new item to the list):

 

   An error occurred during the processing of . Content controls have to be top-level controls in a content page or a nested master page that references a master page.

in SPD, the error says:

Master Page error

The page has one or more <asp:Content> controls that do not correspond with <asp:ContentPlaceHolder> controls in the Master Page.

Attach a different Master Page or change the mapping of the content regions, or correct the problem in Code View:

-PlaceHolderMain

 

I changed the src attributes to match where I placed the Javascript files (i.e.- ../sandbox/Advertising/jQuery/Forms/jquery-1.3.2.min.js and ../sandbox/Advertising/jQuery/Forms/jquery.SPServices-0.4.1.min.js).

Also, for when i get this working, there is also a grandchild list. so would i paste the entire code again and just change the column names?

 

Thanks for the help! I have been continually impressed with how supportive the SharePoint community is. After reading several of your posts I see that you too are a fine example of that patience!

 

~Tasha

Oct 27, 2009 at 5:04 PM

hmmm, that turned into gobbledegook, didn't it?

 

those two lines at the bottom go on the top. I tried to edit it, but they were fine in edit, so.....hopefully you can translate!

Coordinator
Oct 27, 2009 at 5:21 PM

To quote Red on the Red/Green Show, "We're all in this together."

Did you by any chance add the line:

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

into your page?  I meant to just add the scripting pieces below that existing line.

And, yes, to cascade multiple columns, you just add the code sequentially.

M.

Oct 27, 2009 at 6:05 PM
Edited Oct 27, 2009 at 6:40 PM

Unfortunately, I did not add the line

 

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> 

 

I just pasted the remaining script below that line in the code on the NewFormCustom.aspx.

Coordinator
Oct 27, 2009 at 7:03 PM
Edited Oct 27, 2009 at 7:43 PM

It's always hard to debug blind.  Can you send me your NewFormCustom.aspx page's code?

Thanks,
M.

Coordinator
Oct 27, 2009 at 7:47 PM

Tasha:

I don't see anything in the code you sent me that should cause a problem, other than the fact that you should use relative links for the src attributes on your scripts. (/sandbox/Advertising/jQuery/Forms/jquery-1.3.2.min.js instead of http://vpmosstest:8001/sandbox/Advertising/jQuery/Forms/jquery-1.3.2.min.js)

Try taking a new copy of NewForm.aspx and adding the code into it.

M.

Oct 27, 2009 at 10:53 PM
Edited Oct 28, 2009 at 3:36 PM

Okay, so redoing it I no longer have the error. But, my Cascading Drop Downs do not work. Just like Branleejo, I can still see all of the choices.

Coordinator
Oct 27, 2009 at 11:01 PM
Edited Oct 28, 2009 at 3:31 AM
Are you seeing any errors? (Yellow indicator in lower left in IE.)
Try adding a simple alert into the document.ready function so that you can be sure the .js files are loading correctly:
alert("hello world");
M.
Oct 28, 2009 at 12:08 AM

Hi
I have been following this thread and was able to get everything to work on my site based on your explanation.
Thank you for your great work, I have been searching for quit some time for a solution...

I have one problem though that I need to solve…
I have a Service list with 3 columns: Product, Part and Failure:
As more then one Failure can occur in a Part I need to support
"Allow multiple values” but as I check this option for the Failure Lookup column the failures are no longer filtered. Hence I can now see “all” Failures in the list (and not only the ones based on previous selection in the Part dropdownlist.
Am I doing something wrong or is this option not supported? (if not can it easily be adapted to work in this way?).

One step further is actually that it would be even better if I could also have “Allow multiple values” on the Part column (as it is also possible that there are failures on more then one Part in a Product).

Thanks, Lisa

Coordinator
Oct 28, 2009 at 3:33 AM

Lisa:

It's on my list for v0.5.0 to make SPCascadeDropdowns work for multi-select columns both as parents and children.  I don't have a definite date for that release yet, but it should be in the next few weeks at most.

M.

Oct 28, 2009 at 2:27 PM
Great!
Looking forward to that release and amd whenever there is a beta to try out I would be happy to test it ;o)
Thanks again for your great support and fast respons.
Lisa
Oct 28, 2009 at 3:42 PM

Hello again,

So I did not have any yellow indicator, and I did recieve the alert when I included it like this:

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script type="text/javascript" language="javascript" src="/sandbox/Advertising/jQuery/Forms/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript" src="/sandbox/Advertising/jQuery/Forms/jquery.SPServices-0.4.1.js"></script>
<script type="text/javascript">
 alert("Hello Tasha");
    $(document).ready(function() {
     $().SPServices.SPCascadeDropdowns({
            relationshipList: "InsertReservations",
            relationshipListParentColumn: "Cities",
            relationshipListChildColumn: "ZipCodes",
            parentColumn: "City",
            childColumn: "ZipCode"
        });
        $().SPServices.SPCascadeDropdowns({
   relationshipList: "InsertReservations",
   relationshipListParentColumn: "ZipCodes",
   relationshipListChildColumn: "CirculationByDay",
   parentColumn: "ZipCode",
   childColumn: "CircByDay"
        });
    });
</script>

But not when i included it like this:

 

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script type="text/javascript" language="javascript" src="/sandbox/Advertising/jQuery/Forms/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript" src="/sandbox/Advertising/jQuery/Forms/jquery.SPServices-0.4.1.js"></script>
<script type="text/javascript">
     $(document).ready(function() {

     alert("Hello Tasha");
     $().SPServices.SPCascadeDropdowns({
            relationshipList: "InsertReservations",
            relationshipListParentColumn: "Cities",
            relationshipListChildColumn: "ZipCodes",
            parentColumn: "City",
            childColumn: "ZipCode"
        });
        $().SPServices.SPCascadeDropdowns({
   relationshipList: "InsertReservations",
   relationshipListParentColumn: "ZipCodes",
   relationshipListChildColumn: "CirculationByDay",
   parentColumn: "ZipCode",
   childColumn: "CircByDay"
        });
    });
</script>

 

(Don't judge me! Some days even just the computer saying Hi makes me feel a little bit better!)

Coordinator
Oct 28, 2009 at 4:35 PM
So since you got the alert outside the jQuery but not inside it, I think your src locations for the script files aren't right yet.

M.



On Oct 28, 2009, at 10:35, "Tasha" <notifications@codeplex.com> wrote:

From: Tasha

Hello again,

So I did not have any yellow indicator, and I did recieve the alert when I included it like this:

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

But not when i included it like this:

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

<script type="text/javascript">
$(document).ready(function() {

alert("Hello Tasha");
$().SPServices.SPCascadeDropdowns({
relationshipList: "InsertReservations",
relationshipListParentColumn: "Cities",
relationshipListChildColumn: "ZipCodes",
parentColumn: "City",
childColumn: "ZipCode"
});
$().SPServices.SPCascadeDropdowns({
relationshipList: "InsertReservations",
relationshipListParentColumn: "ZipCodes",
relationshipListChildColumn: "CirculationByDay",
parentColumn: "ZipCode",
childColumn: "CircByDay"
});
});
</script>

(Don't judge me! Some days even just the computer saying Hi makes me feel a little bit better!)

Oct 28, 2009 at 5:45 PM

So i moved the jQuery files from the root to the doc library on the site, and now the alert works within the (document).ready(function():

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script type="text/javascript" language="javascript" src="/sandbox/Advertising/tasha/jQuery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript" src="/sandbox/Advertising/tasha/jQuery/jquery.SPServices-0.4.1.js"></script>
<script type="text/javascript">
 $(document).ready(function() {
 alert("Hello Tasha");
     $().SPServices.SPCascadeDropdowns({
            relationshipList: "InsertReservations",
            relationshipListParentColumn: "Cities",
            relationshipListChildColumn: "ZipCodes",
            parentColumn: "City",
            childColumn: "ZipCode"
        });
        $().SPServices.SPCascadeDropdowns({
   relationshipList: "InsertReservations",
   relationshipListParentColumn: "ZipCodes",
   relationshipListChildColumn: "CirculationByDay",
   parentColumn: "ZipCode",
   childColumn: "CircByDay"
        });
    });
</script>
<table cellpadding=0 cellspacing=0 id="onetIDListForm">

 

However, the cascading lists still do not work. Perhaps there is something not on the script side that I am not doing right. I have 4 total lists. Three are info buckets and one is the list where the cascade is supposed to work (InsertReservations):

  • Cities (one column-single line of text list with various entries)
  • ZipCodes (a list with two columns, a lookup to cities and single line of text containing zip codes that belong to each city)
  • CirculationByDay (a list with two columns, a lookup to ZipCodes and single line of text containing data)
  • InsertReservations (three columns-City with a lookup to City column under Cities, ZipCode with a lookup to ZipCode column under ZipCodes, CircByDay with a lookup to CircByDay column under CirculationByDay)  

I apologize for keeping you busy, and I second Lisa's comments about great support and fast response-your help has been tremendous!

Oct 28, 2009 at 5:50 PM

I have the same problem as Tasha. I had just put this project on the backburner until Tasha started commenting on the thread, and I picked it back up again. I went ahead and added the alert as you suggeted for her, and the alert worked fine for me from the get-go. But, my drop-downs still display everything, regardless of my selection in what is supposed to be the parent.

Oct 28, 2009 at 8:04 PM

Same here. I have been following along as well with the same results as branleejo and Tasha......I keep feeling like im missing something....?

Coordinator
Oct 28, 2009 at 8:58 PM

Ok, now you guys are worrying me.  One person having problems could just be human error, but now we're up to 4 people, so I'm hoping I don't have a bug.

Let's keep working through Tasha's example, and simplify as mush as possible.  Let's focus on the City -> Zip Code relationship.  It sounds like the list called ZipCodes has two columns: Title (which contains the ZipCode) and City (which is a lookup to the Title column in the Cities list).  So the contents of the ZipCodes list ought to look like this:

Title      City
02445    Brookline
02115    Boston
44484    Warren

I'm going to assume that the ZipCodes list lives in the same site as the list where we are trying to cascade the dropdowns on the form.  On that form, there is a column called City and a column called ZipCode. Based on all of this, the jQuery function ought to look like this:

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script type="text/javascript" language="javascript" src="/sandbox/Advertising/tasha/jQuery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript" src="/sandbox/Advertising/tasha/jQuery/jquery.SPServices-0.4.1.js"></script>
<script type="text/javascript">
 $(document).ready(function() {
 alert("Hello Tasha");
     $().SPServices.SPCascadeDropdowns({
            relationshipList: "ZipCodes",  // The name of the list which contains the parent/child relationships
            relationshipListParentColumn: "City",  // The internal name of the parent column in the relationship list
            relationshipListChildColumn: "Title",   // The internal name of the child column in the relationship list
            parentColumn: "City",  // The display name of the parent column in the form
            childColumn: "ZipCode"  // The display name of the child column in the form
        });
    });
</script>
<table cellpadding=0 cellspacing=0 id="onetIDListForm">

Tasha, can you try this and report back for everyone?  I'm also assuming that you are all using IE?  This ought to work with Firefox, but I know that Safari has issues, and that is on my list to look at.

M.

Oct 28, 2009 at 9:50 PM

I tried this and unfortunately it did not work.

I did rename the Title Columns in each list, (City in the Cities List was the Title, ZipCode in the ZipCodes list, and CircByDay in the CirculationByDay List). In my InsertReservation list (the one tha pulls them all together, hopefully), the Title is hidden. I hope I didn't goof it up here!

The fact that so many people have had success with this tells me that it is indeed user error. I did see mentioned in one fo the forums something about the .min version of the Javascript files not working, and so I did switch to the (not).min version of jquery.SPServices-0.4.1.js, but was unable to find a (not) .min version of jQuery/jquery-1.3.2.min.js, Could that be the issue?

Thanks again for your continued support. :)

 

Oct 28, 2009 at 11:01 PM

It is working fine for me, but I am not using 4 lists. Only 3, exactly as the example:

 However I also had some issues in the beginning:

First the jQfiles path (<script src="../../jQuery%20Libraries/jquery.SPServices-0.4.1.min.js"></script>) was incorrect as I had placed the files in the wrong folder.
But I realised that I could confirm that I had written the right path by Ctrl+clicking the source path (as it is shown in Sharepoint Designer as a Link)
 

Next I had some problems with figuring out which columns to set as look up from the "main" list.
As an example the column data for "Region" exists in both the Regions list (as Title) and in the States list (as Region), however for some reason I could not even select the Region column from the States list when creating a lookup from the main list (I assume it's becuase of it already beeing a lookup column in itself?)

 

Anyway I thought I'd share exactly what type of columns I selected in each list for comparison. It's basically the same as the example provided, with one difference only. I could not get the cascading lists to work properly when I used the Failure column in the jQFailures list (Equiv. to State column in the States list). I'm thinking it had something to do with the renaming the original Title column in the list instead of creating a new column?

Instead I had to use"LinkTitle" which contains the same data. I found this column by looking at the list in Sharepoint Designer - selecting the list in Data source library, right click on it and selecting Show Data (then all columns in the list is displayed with example data).

My lists:
jQParts (equiv. to Regions list) with columns: Title (Single line of text), Product (Single line of text)
jQFailures (equiv. to States list) with columns: Failure (Single line of text), Failure desc (Single line of text), Part (lookup to JQParts.Title)
jQCascadedLookUpTest (the "main" list) with columns: Product (lookup to jQParts.Product), Part (lookup to jQParts.Title), Failure (lookup to jQFailures.Failure) 

Column names translated:
Part = Region
Product = Country
Failure = State

 My code: 

<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"/>
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script src="../../jQuery%20Libraries/jquery-1.3.2.js"></script>
<script src="../../jQuery%20Libraries/jquery.SPServices-0.4.1.min.js"></script>
<script>
 $(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "jQParts",
   relationshipListParentColumn: "Product",
   relationshipListChildColumn: "Title",
   parentColumn: "Product",
   childColumn: "Part"
  });
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "jQFailures",
   relationshipListParentColumn: "Part",
   relationshipListChildColumn: "LinkTitle",
   parentColumn: "Part",
   childColumn: "Failure"
  });
 });
</script>

I don't know if this helps in anyway or only contributes to the confusion ;o)
Cheers, Lisa

Coordinator
Oct 29, 2009 at 3:26 AM

Brava, Lisa!

A few things:

  • The src attribute in <script src="../../jQuery%20Libraries/jquery-1.3.2.js"></scriptshould point to where *you* put the .js files.  You can store them anywhere that makes sense for your needs.  To reiterate my suggestion: I recommend putting them into a Document Library in the root of your Site Collection called something like jQuery Libraries. However, they can be stored anywhere as long as all users who need to access them have read permissions.
  • relationshipListParentColumn and relationshipListChildColumn should be the internal name (also known as the StaticName) for the columns in the relationshipList.  parentColumn and childColumn should be the DisplayNames for the columns on the form.
    • When you first create a column in a list, the name which you give the column becomes the StaticName.
    • The StaticName is encoded, meaning that certain characters are replaced with a set of characters which represent their ASCII value.  So if you name a column Product Description, the StaticName will be Product_x0020_Description.
    • If you aren't sure what the StaticName for a column is, go into List Settings, click on the column name in the Columns section, and look at the URL.  At the end of the URL, you'll see a Query String parameter called Field&Field=Lead%5Fx0020%5FSource.  The string after the = sign is the StaticName, in this case Lead_x0020_Source.  The %5F values are the underscores encoded for the URL.  I know this can be confusing if you aren't familiar with these concepts.
    • If you subsequently change the column name (like renaming Title to Failure), the StaticName stays static (does not change), but the DisplayName does change.
    • One of the dangers of this is that a column is renamed several times and ends up being used for something entirely different than its original intent.  Because of this, it's often better to delete a column and add a new one than renaming it.
  • It looks like you've created the lists to drive the cascading dropdowns *only* to drive the cascading dropdowns.  These lists are the best practice way to manage the choices that are available to a user in list columns.  This is a key concept way beyond the cascading dropdowns idea:
    • Things like States or Regions or Products or Parts ought to be created as Site Columns in the root of your Site Collection which are lookups into lists and then used everywhere in the Site Collection you need them.
    • Because the choices are stored in a list, you can manage them as content as opposed to as settings, applying content management rules or workflows, as needed.
    • Since the values are stored in one place and a change in the list ripples out to every list or library where the Site Column is used.  This is an incredibly powerful capability in SharePoint that is totally underused and ensures information uniformity and a good information architecture.
    • By taking advantage of this capability, you can begin to enforce a common taxonomy of concepts which apply across the organization.  Rather than calling Product 12345 the Blue Widget and the Left Screwed Thing and the One that J&J Buys, we all can call it Product 12345 and understand what we are all talking about.

Hope this helps.

M.

Coordinator
Oct 29, 2009 at 4:32 AM

The above turned into a nice blog post, so, see, your questions are useful!

Now let's get this darn thing running for you all.

M.

Oct 29, 2009 at 5:45 PM

Okay, time for a progress update:

I went back into my Zip Code list, removed the lookup to the City list and created a new City column that is single line of text. I also changed my code to this:

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script type="text/javascript" language="javascript" src="/sandbox/Advertising/tasha/jQuery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript" src="/sandbox/Advertising/tasha/jQuery/jquery.SPServices-0.4.1.js"></script>
<script type="text/javascript">
 $(document).ready(function() {
 alert("Hello Tasha");
     $().SPServices.SPCascadeDropdowns({
            relationshipList: "ZipCodes",
            relationshipListParentColumn: "City",
            relationshipListChildColumn: "LinkTitle",
            parentColumn: "City",
            childColumn: "ZipCode"
        });
        $().SPServices.SPCascadeDropdowns({
   relationshipList: "CirculationByDay",
   relationshipListParentColumn: "ZipCode",
   relationshipListChildColumn: "LinkTitle",
   parentColumn: "ZipCode",
   childColumn: "CircByDay"
        });
    });
</script>

This gave me a small, radiant sparkle of success.  My first part of my Cascading List (City and Zip Code) KINDA works. When I choose a city, only the zips for that city show up in the next drop-down. However, in the ZipCode list since the cities are entered for each zip code, in my drop down the cities appear for each time they are entered. Also, the next Parent/Child relationship doesn't work. I even tried removing the lookup colum to zip code and creating a single line of text colum (so that it mirrored the ZipCodes list) to no avail.

Coordinator
Oct 30, 2009 at 4:20 AM

Argh, Tasha.  I'm sorry this is turning out to be such a pain for you.

I'd strip things down by removing the second call to SPCascadeDropdowns and get the first call to work.  Once you've got that one and can see how it holds together, adding the second one ought to be easier.

Are you seeing the "Hello Tasha" alert?  If you are, then we know that the jQuery library reference is correct.

I still think, based on what you've told me about your lists, that this is the right syntax for the first call:

$().SPServices.SPCascadeDropdowns({
            relationshipList: "ZipCodes",  // The name of the list which contains the parent/child relationships
            relationshipListParentColumn: "City",  // The internal name of the parent column in the relationship list
            relationshipListChildColumn: "Title",   // The internal name of the child column in the relationship list
            parentColumn: "City",  // The display name of the parent column in the form
            childColumn: "ZipCode"  // The display name of the child column in the form
        });

Finally, go and take a look at our demo site and how the lists are set up there.  Maybe that will give you further insight:
http://www.sympraxisconsulting.com/Demos/Lists/Sales%20Opportunities/AllItems.aspx
Yuo may need to log in with username=demouser, password=demouser.

The EditFormCustom.aspx page has this jQuery in it:

$(document).ready(function() {
   $().SPServices.SPCascadeDropdowns({
    relationshipWebURL: "/Demos",
    relationshipList: "States",
    relationshipListParentColumn: "Region",
    relationshipListChildColumn: "Title",
    parentColumn: "Region",
    childColumn: "State"
   });
   $().SPServices.SPDisplayRelatedInfo({ 
    columnName: "Region",
    relatedWebURL: "/Demos",
    relatedList: "Regions",
    relatedListColumn: "Title",
    relatedColumns: ["Regional_x0020_Office"],
    displayFormat: "table"
   });
  });

M.

Oct 30, 2009 at 2:46 PM

Good Morning!

I have gotten the first call to *KINDA* work. It filters the second choice (yippee!!!), but the City drop down has multiple instances of each City. For example, since there are 7 Zip Codes in the City List for Chesapeake , Chesapeake is listed 7 times in the list. Then, the second call doesn’t work.

My alert does work, is this placement in the code correct to test the reference?

 <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

<script type="text/javascript">

                $(document).ready(function() {

                alert("Hello!");

                $().SPServices.SPCascadeDropdowns({

            relationshipList: "ZipCodes",

            relationshipListParentColumn: "City",

            relationshipListChildColumn: "LinkTitle",

            parentColumn: "City",

            childColumn: "ZipCode"

        });

        $().SPServices.SPCascadeDropdowns({

                                                relationshipList: "CirculationByDay",

                                                relationshipListParentColumn: "ZipCode",

                                                relationshipListChildColumn: "LinkTitle",

                                                parentColumn: "ZipCode",

                                                childColumn: "CircByDay"

        });

    });

</script>

Thanks again for your patience. I have definitely learned a lot in this process!

Coordinator
Oct 30, 2009 at 2:59 PM

This thread could be its own Codeplex project. ;+)

Methinks maybe your list usage isn't right.  Since your parent column is City, the cascading should apply to the ZipCode column, not the City column.  The City column in the list to which the form belogs should be a lookup into the Cities list, not the ZipCodes list.

M.

Oct 30, 2009 at 3:35 PM

I know, the thread is very lengthy, I am sorry!!

I moved the information for Cities to the ZipCodes list after reading Lisa’s thread and looking at how the example is set up. In the example, there are two lists shown: Regions list and States list. In the Regions list, the two columns are “Title” (this contains the names of the Regions) and Country (containing the names of the Countries). In this list, are the Countries a lookup to a third, not shown, list named “Country”? Following Lisa’s (she has both  Part-jQParts.Title-and Product in the first list just like Regions and Country are in the first list in the example), she references both of these columns from the first list in her master list (both Product and Part are lookups to their respective columns in jQParts).

Once I got rid of the “Cities” list on mine and moved the info to the Zip Code list, that was how I got the first call to work (showing multiple entries for each city). The script that makes this call work does show the City list as the parent and zipcode as the child (with an internal name of “LinkTitle,” like Lisa’s example).

The second call is for a list named CirculationbyDay. In this list there are two columns and this is the list where the ZipCode is the parent and CircByDay is the child. I have tried to get this call to work two different ways using Lisa’s example as a model. First, I made ZipCode a lookup to the ZipCodes List (like how she has Part as a lookup in her second list). This did not work. Then, modeling how the first call works, I removed the lookup to the ZipCodes list and made both columns a single line of text. This also did not work.

In my master list,  I have two lookups to the first list and one lookup to the second list, like in Lisa’s example. The master list gets City and Zip Code from the Zip Code list and CircByDay from the CirculationByDay list.

I think I am going to try wiping everything out and starting fresh. I have tried so many iterations of lookups that I can’t see straight. I think too I will forward this to my user group and see if they can offer any insight. I know I must be doing something wrong!

Coordinator
Oct 30, 2009 at 3:51 PM
Edited Oct 30, 2009 at 3:53 PM

It's all about relational tables, just like a database.

List: Cities
Columns:

  • Title = City Name

List: ZipCodes
Columns:

  • Title = Zip Code
  • City = lookup column to the Title column in the Cities list above

List: CirculationByDay
Columns:

  • Title = CircByDay (What is this?)
  • ZipCode = lookup column to the Title column in the ZipCodes list above

List: ??? (master list?)
Columns:

  • ...whatever other columns...
  • City = lookup column to the Title column in the Cities list above
  • ZipCode = lookup column to the Title column in the ZipCodes list above
  • CircByDay = lookup column to the Title column in the CirculationByDay list above

Then the jQuery looks like:

$().SPServices.SPCascadeDropdowns({
 relationshipList: "ZipCodes",
 relationshipListParentColumn: "City",
 relationshipListChildColumn: "Title",
 parentColumn: "City",
 childColumn: "ZipCode"
});
$().SPServices.SPCascadeDropdowns({
 relationshipList: "CirculationByDay",
 relationshipListParentColumn: "ZipCode",
 relationshipListChildColumn: "Title",
 parentColumn: "ZipCode",
 childColumn: "CircByDay"
});

 M.

Oct 30, 2009 at 6:13 PM

Well, I’m spent. I went in, wiped all of my old stuff out, rebuilt it using everything exactly as you have it here verbatim. The good news is, the first call still works and there is only one instance of each city. Bad news is, second call still doesn’t work, it is still showing all of the choices.  L

Coordinator
Oct 30, 2009 at 6:19 PM

Well, halfway there, then. ;=)

Can you explain the CirculationByDay list again?

M.

Oct 30, 2009 at 6:49 PM

Sure. It’s a list that contains numerical data broken up by day of the week for each Zip Code. So, each zip code has a Monday-Sunday value assigned to it. Since there are multiple zip codes, there are multiple Monday values (one for each zip). In theory, with the Cascading Drop Downs, I select the city and then in the next box only the zips for that city appear. Then once I choose a zip, only the Monday-Sunday values for that zip appear.

Oct 30, 2009 at 7:17 PM

okay, no one is allowed to beat me up. I did all of this again on our LIVE server instead of our test server, and it worked like a CHARM. I feel like a toad for taking so much of your time. O__O

Thanks to everyone for your help. And for those of you having the same issue, if you are doing it on your test server, give your live server a shot.

Oct 30, 2009 at 8:28 PM

noob question: I am new to SPD. In Front Page 2003, if i wanted to edit a page, i would find it in front page, double click it and edit it. In SPD, when i open a page to edit it, it looks like im editing hte default.master page instead of the actual page. When i save i get: Saving your changes will customize a page from the site definition... Is this the page that i am apending the example code in? or is there a diffrent way to open up and edit this page im not aware of in SPD.  Thanks for your input!!

Oct 30, 2009 at 8:39 PM

I knew i should have waited to hit send on the last post.....

Ok, so i think the anser is yes on the above question.....

Also, I got it to work.....

It wasn't working because i place the code near the top of the page. Once i moved it down to about line 26...it worked! Hope this helps somebody. Here is part of the Sharepoint list pages' code with the example code:

more above...........................
<SharePoint:ListItemProperty id="ID_ItemProperty" MaxLength=40 runat="server"/>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server">
	<IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"/>
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

<script language="javascript" type="text/javascript" src="http://gomcollab-testweb.bpweb.bp.com/sites/OperationalExcellence/OperationalExcellence/EPBackboneSupport/jQuery/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript" src="http://gomcollab-testweb.bpweb.bp.com/sites/OperationalExcellence/OperationalExcellence/EPBackboneSupport/jQuery/jquery.SPServices-0.4.1.js"></script>
<script language="javascript" type="text/javascript">

alert("Hello Patrick1");

	$(document).ready(function() {
	
	alert("Hello Patrick2");
	
		$().SPServices.SPCascadeDropdowns({
			relationshipList: "Regions",
			relationshipListParentColumn: "Country",
			relationshipListChildColumn: "Title",
			parentColumn: "Country",
			childColumn: "Region"
		});
		$().SPServices.SPCascadeDropdowns({
			relationshipList: "States",
			relationshipListParentColumn: "Region",
			relationshipListChildColumn: "State",
			parentColumn: "Region",
			childColumn: "State"
		});
	});
</script>





<table cellpadding=0 cellspacing=0 id="onetIDListForm">
 <tr>
  <td>
   
 <WebPartPages:WebPartZone runat="server" FrameType="None" ID="Main" Title="loc:Main"><ZoneTemplate>
<WebPartPages:ListFormWebPart runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{E1D22EC2-6729-4ACD-ADE5-1DF2AFEFE584}" >
<WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
  <Title>CascadeFilter</Title><FrameType>Default</FrameType><Description /><IsIncluded>true</IsIncluded><PartOrder>1</PartOrder><FrameState>Normal</FrameState><Height /><Width /><AllowRemove>true</AllowRemove><AllowZoneChange>true</AllowZoneChange><AllowMinimize>true</AllowMinimize><AllowConnect>true</AllowConnect><AllowEdit>true</AllowEdit><AllowHide>true</AllowHide><IsVisible>true</IsVisible><DetailLink /><HelpLink /><HelpMode>Modeless</HelpMode><Dir>Default</Dir><PartImageSmall /><MissingAssembly>Cannot import this Web Part.</MissingAssembly><PartImageLarge /><IsIncludedFilter /><ExportControlledProperties>true</ExportControlledProperties><ConnectionID>00000000-0000-0000-0000-000000000000</ConnectionID><ID>g_e1d22ec2_6729_4acd_ade5_1df2afefe584</ID><ListName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">{BF5E4983-B695-41B9-89D2-E95E3F8FE5C8}</ListName><ListItemId xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">0</ListItemId><ControlMode xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">New</ControlMode><TemplateName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">ListForm</TemplateName><FormType xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">8</FormType><ViewFlag xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">0</ViewFlag></WebPart></WebPartPages:ListFormWebPart>
</ZoneTemplate></WebPartPages:WebPartZone>......................contiuned

Coordinator
Oct 30, 2009 at 8:43 PM

Tasha: YAY! So glad you got it to work.  You get the "hardest implementation" award this week.  (What a dubious distinction.) It's been no trouble, and thanks for *your* patience.

Patrick: Check the instructions at the bottom of this page for my recommended approach:
http://spservices.codeplex.com/documentation

I'm pretty horrible about reading documentation myself, but I keep trying to improve what's on this site for you folks!

M.

Oct 30, 2009 at 8:48 PM

sympmarc,

you should post a donation paypal link on you page or something...i'm sure people like myself would like to show there appreciation for all your time and help!!

Oct 30, 2009 at 8:49 PM

(a loud trumpet fanfare erupts)  Hee Hee!

Coordinator
Oct 30, 2009 at 8:52 PM

Patrick: Send cookies!  (Actually, I like French Fries better, but they don't travel well.) But seriously, are you serious?

Tasha: ALWAYS better to close out a Friday with a success!

M.

Oct 30, 2009 at 8:59 PM

very serious! I would donate 20 or so over paypal!! I'm sure others would too....post a link on your home page...Im sure your time is valuable!
What you have shown me here helps me advance in my career....20 dollars is a small drop in the bucket compared to how many time i will re-use this filter.

Also, i have never posted on a tread that the admin responded back so fast and so will to help with people of diff skill levels...!!!!! thanks!!!

Oct 30, 2009 at 9:40 PM

Okay, so I started this thread, and I'm the only one who still doesn't have this working. HA! (just when you thought you were done with us, eh Marc).

I had decided to sit back and watch until one of you got yours working, and then try it from there. So, here is what I've done.

List: Cities
Renamed Title to CityName - Field Type: Single line of Text

List: ZipCodes
Renamed Title to ZipCode - Field Type: Single line of Text
City - - > Cities:CityName

MasterList
Title
- I left this alone
City - - > Cities:CityName
ZipCode - - >ZipCodes:ZipCode

I populated Cities:CityName with two city names: Houston and Dallas

I populated ZipCodes:ZipCode with the following bogus values:
75961 - selected Houston from the drop-down
75962 - selected Houston from the drop-down
75963 - selected Houston from the drop-down
12345 - selected Dallas from the drop-down

I opened MasterList in SPD, made a copy of NewPage.aspx and called it NewPageCustom.aspx and changed the List Properties / Supporting Files to point to that page.

I opened NewPageCustom.aspx in SPD edit mode, and added the following code:

<script type="text/javascript" language="javascript" src="../../jQueryLibraries/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript" src="../../jQueryLibraries/jquery.SPServices-0.4.1.js"></script>
<script type="text/javascript">
 $(document).ready(function() {
 alert("Hello Tasha");
     $().SPServices.SPCascadeDropdowns({
            relationshipList: "ZipCodes",  // The name of the list which contains the parent/child relationships
            relationshipListParentColumn: "City",  // The internal name of the parent column in the relationship list
            relationshipListChildColumn: "Title",   // The internal name of the child column in the relationship list
            parentColumn: "City",  // The display name of the parent column in the form
            childColumn: "ZipCode"  // The display name of the child column in the form
        });
});
</script>

The code was placed between the following two lines in the existing page code:

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

When I open the list in IE and add a new item, I DO receive the alert "Hello Tasha"

The fields on the page display as follows:

Title* with an empty text box
City with a drop-down that defaults to None, but let's me select either Houston or Dallas (and Houston only shows up once, like it is supposed to, even though I have it tied to three different zip codes)
ZipCode with a drop-down that reads "Choose ZipCodes..." but that is the only value in the list. None of the zip codes show up.

I feel like I'm so close to having it right that the saying "If it were a snake, it would have bitten me" applies. Any help? 

Thanks,

Brandon 

 

 

 

 

Coordinator
Oct 30, 2009 at 10:06 PM

Brandon:

The answer is as plain as the nose on your face.  Your name isn't Tasha so my function sees that you aren't Tasha and denies you success.

M.

 

 

Buh-dump-bump.

But seriously, everything looks right, and I looked it over three times.  Can you try one thing?  Make City in MasterList required and let me know if anything looks different.  You won't see the (None) value in the NewFormCustom.aspx page, and I'm wondering if that is maybe a bug.

By the way, I've added an issue to help with all of this, and I plan to add some error messages into the next release.

M.

Oct 30, 2009 at 10:17 PM

Hardy-har-har....  Seriously, that was a good one....

I made MasterList:Citiy a required field and now, instead of defaulting to None, it defaults to a city name.

Additionally, the ZipCode drop-down defaults to a corresponding zip-code, for a millisecond, and then changes back to "Choose ZipCodes". When you click the drop-down, again, no zip-codes are in the list.

This IS on a test server, and one day next week, we are moving the site to a brand new, live server, so if needed, I will wait until next week to test this again when the live server is ready. 

 

Coordinator
Oct 30, 2009 at 10:20 PM
Edited Oct 31, 2009 at 3:13 AM
Are you using IE? If so, what version?
M.
Oct 30, 2009 at 10:24 PM

IE v. 7.0.5730.13 on Windows XP Pro Service Pack 3

SPD is version 2007 Service Pack 2

Oct 30, 2009 at 10:49 PM

Sorry i've been away for a minute. looks like i missed some fun stuff!!!

I LOVE that you left "Hello Tasha" as the alert. XD I think Marc is right on that you confused it into thinking you were Tasha and then in it's disappointment that you were not me it denied you success.

But seriously, so you don't think you are crazy, yesterday when I was struggling with this (and had a friend here at work who's familiar with coding watching my every step), i made a whole new set of lists on the test server and got that weird "blip" where the drop down only appeared for a split second.

I know that's not exactly what you were experiencing, but hey, a blip's a blip and i wanted to offer reassurance that you were not insane. Mine was the City dropdown, and you would click on the arrow and the drop box would appear for a millisecond while you tried to choose a city. I'm sure my computer had a great deal of amusement with THAT one. I did try several times to choose a city!

I would bet that you are having the exact same issue I was having. If your old live server is still up, I say give it a shot.

Oct 30, 2009 at 10:57 PM

Thank Tasha. We actually don't have an old or existing live server. We're just impleminting a new SharePoint intranet. I designed it on the test server, and they are in the process of building the live server now. Should be ready next week and maybe this will work then.

I am glad, Tasha, that you and the others following this thread were able to get your lists working. You helped me get further, and I'm sure mine will be working soon, too.

I have to agree with Patrick - Marc, you are incredibly responsive and patient...and quite funny, too. Maybe we'll send you a gift certificate for some McDonalds fries, since ACTUAL fries don't travel well. HA

Coordinator
Oct 31, 2009 at 3:17 AM

I've got three shows this weekend if you want to come on down.

The test vs. production thing is a bugaboo.  Unless Tasha copied everything EXACTLY from one environment to the other (which isn't really possible), I'll be dollars to doughnuts that there was some error in what she had in the first environment.

Brandon, we'll get you up and running.  don't give up!  This stuff really does work!

I'm thinking about putting a button on the home page to contribute to charity rather than to me.  Seems more in the spirit of things.

M.

Nov 2, 2009 at 4:23 PM

 

Hi Marc
Thanks for the detailed explanation regarding naming rules on columns, site columns etc. I learned a lot... or at least I think I did ;o)

I was inspired by your explanation regarding site columns and tried to implement that to the full. I have a Service site and a sub site under the Service site named Deviations. I am now trying to created cascaded lookups for columns in a list ProductPart that is placed under the Service site and show them on a form in the sub site Deviations.
However I cannot get it to works, so I must be doing something wrong...

This is what I did:

1. First I created 3 Site Columns at Service Site level: MobitecProduct, MobitecPart and MobitecFailure all are (Single line of text)

2. Also at Service Site level, I created 2 lists ProductPart with Columns (MobitecProduct, MobitecPart) and PartFailure with Columns (MobitecPart, MobitecFailure) I.e. the lists are using the Site Columns.

 

3. Then I created 3 more Site Columns MobitecProductSiteColumn (lookup to the Column MobitecProduct in the ProductPart list) and did the equvialent for Site Columns naming them as MobitecPartSiteColumn and MobitecFailureSiteColumn
4. I went into the Deviation site (Child site to the Service Site) and created a list Mobitec Deviations. In this list I added the 3 Site Columns created in step 3, naming them Product, Part, Failure).
5. Having done this I went into the NewForm of the Mobitec Deviations list and tried setting the following:

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<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.1.min.js"></script>
<script language="javascript" type="text/javascript">
 $(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "../../../Lists/ProductPart",
   relationshipListParentColumn: "MobitecProduct",
   relationshipListChildColumn: "MobitecPart",
   parentColumn: "Product",
   childColumn: "Part"
  });
 });
</script>

My questions:
Have I misunderstood anything implementing it like this? I have tried to also check that I use the proper "internal column names" in case I renamed any Columns.
What should the relationshipList path look like? I also tried http://service... etc instead of "\..\.." etc but it made no difference.

I know I have it working to some extent because when I have the jQuery stuff in the NewForm the Part column stops showing any information and Shows the text (None), hence I know that I am affecting the lookup to some extent.
The Product column just shows all lookup data from the ProductPart list but multiple objects of the same product just as a normal lookup column would.

Thanks Lisa

Coordinator
Nov 2, 2009 at 6:46 PM
Edited Nov 2, 2009 at 6:49 PM

Lisa:

You're close.  You can't specify the location of the list in the relationshipList option.  You have two choices:

  1. Use the GUID for the list rather than the name.  GUIDs are those yucky looking strings of letters and numbers you see on the URL lots of the time, like B06DCA23-0657-4703-A512-8BB648FE20AA.
  2. Add the webURL option to specify where the list lives. (This is my preference, and thus is built into most of the jQuery Library for SharePoint Web Services functions.)

So your call becomes (if I'm reading your comment correctly):

<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.1.min.js"></script>
<script language="javascript" type="text/javascript">
 $(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
   relationshipWebURL: "/Service",
   relationshipList: "ProductPart",
   relationshipListParentColumn: "MobitecProduct",
   relationshipListChildColumn: "MobitecPart",
   parentColumn: "Product",
   childColumn: "Part"
  });
 });
</script>

M.

Nov 4, 2009 at 1:34 AM

Thanks again Marc,
By implementing as you suggested I can almost get it to work properly... However I have some really strange behaviour on the ParentColumn (Product).
It continues to show the "standard" combobox with "(None)" at the top instead of "Choose ...". Also the items are not distinct values.

 

This is what the almost working code looks like:

 

$(document).ready(function() {
$().SPServices.SPCascadeDropdowns({
relationshipWebURL: "
http://service.mobitec.eu",
relationshipList: "ProductPart",
relationshipListParentColumn: "Product",
relationshipListChildColumn: "Part",
parentColumn: "Product",
childColumn: "Part"
});
 

The result of the code above is that the childColumn will populate properly with items, but the parentColumn will behave like mentioned at top (Not working).
As I couldn't get the parentColumn to work properly, I temporarily tried setting parentColumn: followed by relationshipListParentColumn:  as empty strings, just to watch how the Cascading drop downs would act if the data wasn't properly set.

When setting the relationshipListParentColumn: "" The ChildColumn continues to display the text "Choose ...", but obviously without any items. So my conclusion was that that part must have been correct.

When instead setting the ParentColumn: "" The ChildColumn now display the text "(None)", so my conclusion was that that part must have been correct before also?

What can be the reason for this behaviour? Can I get this result by not setting up the ProductPart list in a proper way? 
ProductPart is just a list with columns: Title, Product and Part (all single line of text).
The "Main list" contains the lookup columns Product and Part using Site Columns (which are lookups to the ProductPart list).

The only difference at all between this thing that I cannot get to work and other examples that I have running/working is the use of relationshipWebURL (as ProductPart is in the parent site) and the use of Site Columns in the "main list".
In previous setups I always created a new lookup column to the ProductPart list instead of using Site Columns.

 

It's amazing how stupid I feel, not getting this few lines of code to work properly! Thanks for your patience, and don’t forget to set that Donate stuff up! ;o)

/Lisa
Coordinator
Nov 4, 2009 at 2:24 AM
Edited Nov 4, 2009 at 2:25 AM

Lisa:

I'll have to admit that I've lost the thread on this thread.  I'm not sure if this is a new example, if you have some instances of SPCascadingDropdowns and not others, etc.  It's me, not you.

relationshipWebURL needs to indicate where to look for the list.  I think in this case it would be relationshipWebURL: "/" for the root?  You only need to specify relationshipWebURL if the list is not in the same site as the form.

It also sounds like you have three columns stuffed into the ProductPart list where there ought to be separate lists.  I'm not sure of your background, but the lists ought to be like relational tables and contain the relationships.  So to use the same notation I used above for Tasha, would it be:

List: Products
Columns:

  • Title =Product

List: Parts
Columns:

  • Title = Part
  • Product = lookup column to the Title column in the Products list above

This construct would support one cascading relationship like this:

$(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
    relationshipWebURL: "/",
    relationshipList: "Parts",
    relationshipListParentColumn: "Product",
    relationshipListChildColumn: "Title",
    parentColumn: "Product",
    childColumn: "Part"
  });
}); 

M.

Nov 4, 2009 at 2:09 PM

 For what it is worth, I only got the “Choose a (Zip Code, in my case)” to work once, and right now my cascades work but there is no “Choose” message. It just says “none” in the City drop menu.

Nov 4, 2009 at 2:20 PM

Tasha,

After the last explanation from Marc, I have the exact same status as you do right now...  (if I understand you correctly).
The first Parent Column will never display Choose..., but the cascades work.

Cheers, Lisa

Coordinator
Nov 4, 2009 at 2:25 PM

The "Choose [childColumn]..." option will only show in the child column, not the parent.  (If you chain your cascading dropdowns, it can appear in the "parent" when it takes its turn as the "child".)  The "Choose [childColumn]..." option actually causes a bug if the column is required to have a value, so I'm going to remove that option.  It's inconsistent with what SharePoint displays, anyway, and I'd rather have the dropdowns act "normal", even with the cascading.

See this issue for a description of the bug.

M.

Nov 4, 2009 at 2:32 PM

Thanks Marc,
First time ever that I am happy to see a bug ;o) At least it means I have it all working now!

Lisa

Nov 4, 2009 at 2:52 PM

For me, the “Choose…” did not appear for the child columns either. And in the master list, none of the columns is required. Some of the columns are required in their “host” lists, but that is because I left the column as Title, which is required by default.

The “Choose” thing was a nice to have, but not a deal breaker. Like Lisa said, I am just happy my cascades work! You all do some great work over there and I am astounded at the level of service you have provided. It’s deeply appreciated. J

Coordinator
Nov 4, 2009 at 3:32 PM

Sorry.  You'll see the "Choose [childColumn]..." option if the child control is a standard select, which means fewer than 20 [unfiltered] options.  When there are 20+ options, SharePoint generates the hybrid input/select control, which I handle differently in the library, and you won't see the "Choose [childColumn]..." option.

In any case, in v0.5.0, I will make the behavior match the SharePoint default.

M.

Nov 4, 2009 at 3:43 PM
Edited Nov 4, 2009 at 3:44 PM

Thanks Marc! I saw your twitter pic on the SharePoint Saturday Site, nice to put a face to all that help!!! :-D

 

 

Coordinator
Nov 4, 2009 at 3:52 PM

;+) Hopefully you're following @jQSPWS and maybe even me (@sympmarc) for news about the library, too.

M.

Nov 5, 2009 at 12:09 AM
Edited Nov 5, 2009 at 1:58 PM

I want to start by saying thank you for your efforts, you have provided a set of excellent tools and your help on this board has been exemplary.

My Setup:

3 Lists are the source for the dropdowns: System (is related to) Component (is related to) SubComponent

I am using a List called [Technical Metrics] where I call the 3 Lists above as lookups

My Code:

<script language="javascript" type="text/javascript" src="http://espportal/ITPIP/Admin_JQuery/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript" src="http://espportal/ITPIP/Admin_JQuery/jquery.SPServices-0.4.1.min.js"></script>
<script language="javascript" type="text/javascript">
 $(document).ready(function() { 
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "Component",
   relationshipListParentColumn: "System",
   relationshipListChildColumn: "Title",
   parentColumn: "System",
   childColumn: "Component"
  }); 
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "SubComponent",
   relationshipListParentColumn: "Component",
   relationshipListChildColumn: "Title",
   parentColumn: "Component",
   childColumn: "SubComponent"
  });  
 });
</script>

My Issue:

I can get either cascade to work but only the first one in line will work - when I move the code around the filter changes so I am sure that both blocks of code work just not together.

Note: I am using a trick to add a Content Editor Web Part to my NewForm page (add /NewForm.aspx?ToolPaneView=2 to the URL and hit enter and the page will open in admin edit mode). However, I have tried adding the code through Designer and I get the same results.

Thanks for your help.

Nov 5, 2009 at 12:49 AM

Hi there, sorry another query.  I have managed to get this work, it is fantastic thanks.  I just copied the lists and code that you set up above with cities and zipcodes etc.

My query is, on the master list, I added the columns City, ZipCode, CircByDay pointing to the relationship lists which work on my Edit Form.
I then added another three columns City2, ZipCode2, CircByDay2 that point to the same relationship lists.

I am assuming it doesn't matter what you call your columns in the master list as long as it looks at the correct columns in the relationship lists.

The second cascading dropdown on my edit form doesn't work.  Is it possible to have both working?  I know nothing about jscript.

Thanks for your help.

Coordinator
Nov 5, 2009 at 3:52 AM

Ken:

I can't see anything obviously wrong with what you have shown above.  Multiple calls to SPCascadeDropdowns ought to work.  The only thing that I question is your absolute references to the .js files.  Try this:

<script language="javascript" type="text/javascript" src="/ITPIP/Admin_JQuery/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/ITPIP/Admin_JQuery/jquery.SPServices-0.4.1.min.js"></script>

When you say the first in line will work but not the second, do you see any errors?  Do the dropdowns look ay different than the defaults?  Try putting a few alerts into the jQuery code block so that you can see if there's an error occurring:

$(document).ready(function() { 
  alert("Before first SPCascadeDropdowns call...");
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "Component",
   relationshipListParentColumn: "System",
   relationshipListChildColumn: "Title",
   parentColumn: "System",
   childColumn: "Component"
  }); 
  alert("After first SPCascadeDropdowns call...");
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "SubComponent",
   relationshipListParentColumn: "Component",
   relationshipListChildColumn: "Title",
   parentColumn: "Component",
   childColumn: "SubComponent"
  });  
  alert("After second SPCascadeDropdowns call...");
 });

Standard debugging stuff. If all three alerts don't pop up, then you have some sort of error. (Or I have some sort of bug.)

M.

Coordinator
Nov 5, 2009 at 3:57 AM

eam:

"My query is, on the master list, I added the columns City, ZipCode, CircByDay pointing to the relationship lists which work on my Edit Form.
I then added another three columns City2, ZipCode2, CircByDay2 that point to the same relationship lists."

I'm not sure exactly what you're trying to do with this, but yes, it ought to work.  You'd have to change the calls to SPCascadeDropdowns to reflect the different column names, of course.

When you say the second cascading dropdown doesn't work, do you mean the second series (City2, ZipCode2, CircByDay2)?  See my questions and suggestions to Ken above.

M.

Nov 5, 2009 at 2:12 PM
Edited Nov 5, 2009 at 3:20 PM

Thanks for the prompt reply. I have tried the standard debug steps which is why I am sure the code is 100% working in isolation. All alerts fire fine but only the Component list is filtered.

System (no filter should be applied and none is)

Component (filter applied as designed - no list content is available until the System is selected)

SubComponent (no filter applied but one should be - full list content is available)

A few notes:

1. I see the (none) option in the Component picklist not the "Choose..." text I have seen referenced

2. There is a duplicate record in the System dropdown values - the first record appears twice but this is not the case in the actual source list

3. No errors are reported by the system

4. If I reverse the order of the subroutine calls the filtered drop down changes (e.g. the SubComponent dropdown is filtered but not the Component)

5. I have other dropdowns in the form and they show the (none) value in the form when first loaded while the three fields I am using (System, Component, and SubComponent) show empty field until I click them (I cannot attach a picture or I would show you).

Thanks again for your help. This tool is making a huge impact on this application and the team cannot wait for the mult-select version of your code.

 

 

 

 

 

Coordinator
Nov 5, 2009 at 3:25 PM

Ken:

Can you document you lists in the notation we've been using above, e.g.,:

List: Systems
Columns:

  • Title = System 

The duplicate value in the System column on the form doesn't make sense to me unless your source list for the Lookup has a duplicate.  As I noted above, the "Choose [childColumn]" option will only appear if there are fewer than 20 options.  Can you send me some screenshots? marc dot anderson [at] sympraxisconsulting dot com

Great to hear the library is making an positive impact!

M.

Nov 5, 2009 at 3:42 PM

Sure,

List: System

  • Title = Sytem

List: Component:

  • Title = Component
  • System = System

List: SubComponent:

  • Title = SubComponent
  • Component = Component

All three lists are referenced in the List: [Technical Metrics]

Coordinator
Nov 5, 2009 at 4:05 PM

Brandon, you're probably getting tired of hearing from this thread!  We should probably shunt new questions off into new threads.

Ken:

OK, so from what I can see, all three of your columns in the Technical Metrics list have 20+ options. Can I assume the following?

Technical Metrics : System is a Lookup column into the System list, Title column
Technical Metrics : Component is a Lookup column into the Component list, Title column
Technical Metrics : SubComponent is a Lookup column into the SubComponent list, Title column

If these assumptions are correct, then I think I need to try to reproduce this.

M.

Nov 5, 2009 at 6:30 PM

Correct on all accounts. If I couldn't swap out the calls to your subroutine I would think I got the syntax wrong but I just tried it again and sure enough - either call will work but only the first one. What would happen if I called the routine twice from two seperate but complete blocks of code (e.g. put in two CEWPs and add one call to each with the surrounding code)?

Coordinator
Nov 5, 2009 at 7:17 PM

Ken:

I'd be interested in that answer to that question, too.  Give it a try!  My only remaining questions (at the moment):

  • What browser and version are you using?
  • What version of the library?
  • Any odd characters in your lists? (ampersands, etc.)

If you can send me the list contents, then I can try to reproduce exactly. If you can't do that due to non-disclosure, privacy, etc., I understand.  I'll try to reproduce this tonight.

M.

Nov 5, 2009 at 7:26 PM
Edited Nov 5, 2009 at 9:30 PM

Browser version: IE 7.0.5730.13

JQuery: 1.3.2

Your Code: 0.4.1

No special characters in the list structure (names) or content that I can see. I will ask about sending the content but since it is pretty much my client's entire IT architecture I am betting no go.

I just tried two seperate code blocks and no luck. The second block works but the first does not - there are no errors the filter simply does not work.

Nov 5, 2009 at 9:32 PM

Hi Marc

Yes sorry I meant I can't get the second series (City2, ZipCode2, CircByDay2) to work.  I need each item in the library to have 3 series of the same dropdowns.

I am not sure if I changed the calls to SPCascadeDropdowns to reflect the different column names correctly as not sure how to do this.

This is what I changed it to, and it breaks the first series (allows me to choose a city but there is nothing under zip and circ, and the second series just has all list items in the dropdown.  So obviously I have done it completely wrong.

<script type="text/javascript" language="javascript" src="/Scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" language="javascript" src="/Scripts/jquery.SPServices-0.4.1.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $().SPServices.SPCascadeDropdowns({
 relationshipList: "ZipCodes",
 relationshipListParentColumn: "City",
 relationshipListChildColumn: "Title",
 parentColumn: "City",
 childColumn: "ZipCode"
});
$().SPServices.SPCascadeDropdowns({
 relationshipList: "CirculationByDay",
 relationshipListParentColumn: "ZipCode",
 relationshipListChildColumn: "Title",
 parentColumn: "ZipCode",
 childColumn: "CircByDay"
});
   $().SPServices.SPCascadeDropdowns({
 relationshipList: "ZipCodes",
 relationshipListParentColumn: "City",
 relationshipListChildColumn: "Title",
 parentColumn: "City2",
 childColumn: "ZipCode2"
});
$().SPServices.SPCascadeDropdowns({
 relationshipList: "CirculationByDay",
 relationshipListParentColumn: "ZipCode",
 relationshipListChildColumn: "Title",
 parentColumn: "ZipCode2",
 childColumn: "CircByDay2"
});
 });
</script>

Nov 5, 2009 at 9:44 PM

Sorry, talking rubbish, it doesn't break the first set, it just doesn't do anything to the second set.

Coordinator
Nov 6, 2009 at 12:48 PM

eam:

If you remove the first two calls, does the second set work correctly?

M.

Coordinator
Nov 7, 2009 at 5:41 PM
Edited Nov 8, 2009 at 4:07 AM

Ken (kenlewisesq):

Sorry, I dropped the ball on you.  I'll try to reproduce this weekend, I promise.

M.

Nov 8, 2009 at 3:01 AM

No worries. I appreciate you taking the time to look into things.

Coordinator
Nov 8, 2009 at 3:03 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Nov 8, 2009 at 8:55 PM

Hi Marc

Thanks so much.  Removed the first two calls and it still didn't work.  So then I realised I had put a lower case 'c' in Zipcode2, my bad, once I changed that it worked.

Simple things ay!!

Appreciate your help.

Coordinator
Nov 9, 2009 at 1:06 AM

eam:

Great!  Glad you got it working!  Let me know if you need any more help.

M.

Coordinator
Nov 12, 2009 at 12:47 PM

All:

In case you didn't see the other ways I publicized it, I released v0.4.5 on Tuesday.  It has a new debug mode which may help you with any remaining problems you might have. If not, keep the questions coming! To get future updates, follow @jQSPWS.

M.

Nov 13, 2009 at 1:55 PM

Marc, you are the awesomest!!!

Coordinator
Nov 13, 2009 at 2:08 PM
Now that's a sentiment I can live with! Thanks.



On Nov 13, 2009, at 8:48, "Tasha" <notifications@codeplex.com> wrote:

From: Tasha

Marc, you are the awesomest!!!

Nov 13, 2009 at 2:27 PM

Hi Marc
Thanks for the debug... it really helped me to get the SUPER NICE! SPDisplayRelatedInfo up and running! What a nice present before the weekend! A Million thanks...
Now just eagerly awaiting the Allow multiple Items feature... ;o)

Coordinator
Dec 8, 2009 at 9:33 PM

All:

For those of you in this thread who were interested in contributing something for the value that this library provides, I'd appreciate it if you would visit the project home page and click through to donate to the Museum of Science.  I'd rather have you give whatever you'd like to them than take anything myself.  I'm not sure that they have believed me when I've said that I wanted to add a badge to my site so that folks can donate, so I'd appreciate it if you could show them how great the SharePoint community is by donating whatever you can!

Thanks,
M.

Dec 8, 2009 at 9:46 PM

Many thanks for your support!

Thank you for your recent gift to the Museum of Science. Your support helps us promote science and technology
education throughout our community, and beyond. For each of our 1.5 million annual visitors, the Museum inspires
critical thinking, scientific understanding -- even a sense of wonder. We couldn't do it without you, and we hope
you'll plan to visit us soon!

Sincerely,
Joan S. Hadly
Senior Vice President, Advancement
Museum of Science, Boston
mos.org

Gift Details

Please print this email for your tax records.

Date: December 08, 2009
Donation made from:Patrick Flanagan
Amount received:$20

------------------------------------------------------

Thanks Marc!

Coordinator
Dec 9, 2009 at 7:35 PM

Thanks, Patrick!