Cascading dropdowns can't seem to get it to work

Feb 23, 2010 at 3:18 PM

Hi,

I am stumped.. I have the following in my CEWP:

<script language="javascript" type="text/javascript" src="/sites/GVFVendorStrategy/JQuery/jquery-1.4.1.min.js"></script>
<script language="javascript" type="text/javascript" src="/sites/GVFVendorStrategy/JQuery/jquery.SPServices-0.2.6.js"></script>
<script language="javascript" type="text/javascript">


$(document).ready(function() {
 alert("hi shawn");
 $().SPServices.SPCascadeDropdowns({
  relationshipList: "ReportsList",
  relationshipListParentColumn: "ReportAuthor",
  relationshipListChildColumn: "Title",
  parentColumn: "ReportAuthor",
  childColumn: "RepName",
  debug: true
 });
 
});
</script>

I get the alert, but then my dropdowns aren't filtering... I have a list called ReportAuthor that has only one column of authors (the title column, a list called ReportsList that has a Title column which is the report name and a column called ReportAuthors which is a lookup to the title column of the ReportAuthors list, and a third list where I am trying to do the cascade. The third list is called Reports, it has a lookup column called RepName which gets its values from the ReportsList title column, a lookup called ReportAuthor which gets its values from the ReportAuthors Title column. I want to filter the report names based on the selection of the report author.

Any help would be appreciated!

Coordinator
Feb 23, 2010 at 5:36 PM

I don't see anything obviously wrong with your code. Are you restricted in your environment to SPServices 0.2.6? I only ask becuse if you have the ability to update, the current version is 0.5.1.

Just to confirm, you're using the static names of your fields correct?

Feb 23, 2010 at 9:27 PM

Okay, switching to version 0.5.1 got me closer... I am getting an error message as follows: Error in function: SPServices.SPCascadeDropdowns, Parameter: parentColumn: ReportAuthor, Message: Column not found on page ...I have tried deleting and recreating the column and am still getting the message.

I double checked my static names when I was researching earlier and found that comment in someone else's discussion. So I believe I am good there.

Coordinator
Feb 24, 2010 at 1:55 PM

The Column not found on page error generally means that static name you referenced in the function call isn't on the form.

Given your example code in the previous post, your "ReportAuthor" field is the first field, which changes the choices for "RepName". Make sure your static names are correct, for example if the field was "Report Author" with a space, then the static name would be "Report_x0020_Author".

Coordinator
Feb 24, 2010 at 2:14 PM
The two relationshiplist columns should be the StaticNames for the columns, but both parentColumn and childColumn should be the DisplayNames. Check the documentation for the function if you need more info.

M.



On Feb 24, 2010, at 9:47, "webdes03" <notifications@codeplex.com> wrote:

From: webdes03

The Column not found on page error generally means that static name you referenced in the function call isn't on the form.

Given your example code in the previous post, your "ReportAuthor" field is the first field, which changes the choices for "RepName". Make sure your static names are correct, for example if the field was "Report Author" with a space, then the static name would be "Report_x0020_Author".

Feb 24, 2010 at 6:45 PM

Okay, I am much closer today to figuring this out... first I tried to recreate your construct in your initial example. I was still getting the error related to the parentColumn as noted above. After scanning through the documentation and many, many of the discussions I finally stumbled onto what I think is causing my issue... I had the CEWP on the Allitems.aspx page rather than the Newform.aspx... once I moved it to the Newform.aspx page with your trick "&ToolPaneView=2" I was mostly successful. For what I would like to do, I want to add the cascading dropdowns to a document library... so I think I need the CEWP on the Uploadform.aspx and the trick noted above does not seem to work. I do have access to SharePoint Designer, but am a novice and don't know what to do in there. Again, any help would be appreciated.

Coordinator
Feb 24, 2010 at 8:53 PM

Putting it on Newform.aspx should suffice; I've never had to put it on the upload.aspx page.

In the forms, if you're editing with SharePoint Designer, you'll want to put the scripts directly after the following line:

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

Coordinator
Feb 25, 2010 at 1:24 PM
Edited Mar 1, 2010 at 9:24 PM
Tom:
The CEWP actually should be in the EditForm.aspx. Of course, you should never work with the default form; always work with a copy. If you look at the bottom of the first page of documentation on this site, I believe I outline how you should go about doing this.
When you add a document to a Document Library, you go to upload.aspx to specify the file, and then you are taken to EditForm.aspx to work on the metadata.
M.
Coordinator
Mar 1, 2010 at 9:25 PM
Edited Mar 1, 2010 at 9:26 PM

Tom:

Did you ever get this working? Let me know if you need more help.

M.

Mar 1, 2010 at 9:29 PM

Hi M,

Yes, thank you for following up. Your comment regarding the editform.aspx to work on the metadata for the upload to a document library was exactly what I needed.

Thanks again!

Coordinator
Mar 1, 2010 at 9:31 PM

Great!

M.