SPServices.SPCascadeDropdowns in Doc library

Jul 18, 2011 at 11:16 PM

I have tried several times to get this 123 process and feel i am missing a key element or my limited access truly limits me.

The setup is MOSS 2007, sharepoint designer is a banned product for this server. We rely on client side support and tweaks to manage our site.

Using the dred CEWP I have added some base code to replicate your sample found in documentation and added the script calls for jquery.

<script language="javascript" type="text/javascript" src="/jquery%20libraries/jquery-1.4.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/jquery%20libraries/jquery.SPServices-0.5.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: "Region",
relationshipListChildColumn: "State",
relationshipListSortColumn: "ID",
parentColumn: "Region",
childColumn: "State" });
});
</script>

I also generated your example listsin alignment with this test... I've got to be missing some simple step.

Coordinator
Jul 19, 2011 at 2:57 AM
Edited Jul 19, 2011 at 6:08 PM

ericf2011:

What is happening? You seem to be saying that you're not getting the results you expect, but not what is actually happening.

The most common issue is that the references to the script files aren't correct. Check out this blog post. Even if your references are correct, the versions you're trying to use above are quite old. I'd recommend using the current versions.

Let me know what errors you are seeing or what unexpected behavior and maybe I can help.

M.

Jul 19, 2011 at 5:51 PM

I applied the updates and am now receiving debug errors. Progress... always good.

Unfortunately the errors are saying my references do not exist and I have tried both GUID and by Name.
 
The layout is a dupe of yours on the spservices site. I am only calling the Region to State reference, I have duped all your lists in the test.

End results... 

Error in function

SPServices.SPCascadeDropdowns
Parameter
relationshipListParentColumn: Region
or relationshipListChildColumn: State
Message
Not found in relationshipList States

Click to continue 

Is there a glitch in my CEWP approach?

StateUse SHIFT+ENTER to open the menu (new window). Open Menu

AbbreviatedUse SHIFT+ENTER to open the menu (new window). Open Menu

RegionUse SHIFT+ENTER to open the menu (new window). Open Menu

AlabamaUse SHIFT+ENTER to open the menu (new window).New Edit

AL Southeast

AlbertaUse SHIFT+ENTER to open the menu (new window).New Edit

AB Western Provinces

ArizonaUse SHIFT+ENTER to open the menu (new window).New Edit

AZ Southwest

British ColumbiaUse SHIFT+ENTER to open the menu (new window).New Edit

BC Western Provinces

CaliforniaUse SHIFT+ENTER to open the menu (new window).New Edit

CA Southwest

ColoradoUse SHIFT+ENTER to open the menu (new window).New Edit

CO Mountain

DelawareUse SHIFT+ENTER to open the menu (new window).New Edit

DE Mid-Atlantic

FloridaUse SHIFT+ENTER to open the menu (new window).New Edit

FL Southeast

GeorgiaUse SHIFT+ENTER to open the menu (new window).New Edit

GA Southeast

Coordinator
Jul 19, 2011 at 6:10 PM

In my example, I've given the title column a DisplayName of State. If your list still calls that column Title, then your code needs to use Title. That's most likely it?

M.

Jul 20, 2011 at 2:20 AM

I have completely duplicated your list definitions and had another team member double check all i did.
We systematically swapped out the jquery/SPServices libraries for various versions. (Currently we are using the latest of both.)
We have changed the library name to remove the '%20' from the name. We did discover the lowercase states list title, not an issue.
We also used the {GUID} as referenced in documentation, no change in results.

CURRENT
<script language="javascript" type="text/javascript" src="/jquery%20libraries/jquery-1.6.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/jquery%20libraries/jquery.SPServices-0.6.2.min.js"></script>
<script language="javascript" type="text/javascript"> 
$(document).ready(function() {              
$().SPServices.SPCascadeDropdowns({
relationshipList: "States", 
relationshipListParentColumn: "Region", 
relationshipListChildColumn: "State", 
relationshipListSortColumn: "ID", 
parentColumn: "Region", 
childColumn: "State",
debug:true });
});

</script>


 Error in function

SPServices.SPCascadeDropdowns
Parameter
relationshipListParentColumn: Region 
or relationshipListChildColumn: State
Message
Not found in relationshipList States

Click to continue 

Even with this error you can see the code working, it just does not fill in the states that align with the region... it does say 'choose a state'. Evidence of some change.

Coordinator
Jul 20, 2011 at 3:08 AM
Edited Jul 20, 2011 at 3:09 AM

I think that you need:

relationshipListChildColumn: "Title", 

It needs to be the StaicName, not the DisplayName.

I had bad code in my example. I'm surpriased no one has caught it in all the time it's been there!

M.

 

Jul 20, 2011 at 6:43 AM

We actually wondered how you managed that ourselves.
I just don't understand why it can't find the table.
I swapped the static name for the displayname ad Title was added to the error.

<script type="text/javascript" language="javascript" src="/jquery%20libraries/jquery-1.6.2.min.js"></script><script type="text/javascript" language="javascript" src="/jquery%20libraries/jquery.SPServices-0.6.2.min.js"></script><script language="javascript" type="text/javascript"> $(document).ready(function() {                $().SPServices.SPCascadeDropdowns({ relationshipList: "States", relationshipListParentColumn: "Region", relationshipListChildColumn: "Title", relationshipListSortColumn: "ID", parentColumn: "Region", childColumn: "State", debug: true }); });</script>

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

Click to continue
 

Jul 20, 2011 at 7:26 AM

Are you using a page that isn't stored within the context of the list?  IOW, is the page in a Pages library or a different page that isn't an out of the box form that SharePoint generates?

If I remember correctly, this function relies on the URL to do it's magic.  If the page isn't stored in it's default location, it'll throw an error.

Jul 20, 2011 at 7:30 PM

The is a base newitem.aspx with CEWP added

Coordinator
Jul 20, 2011 at 11:10 PM

So the error is telling you that either the column Region or the column Title can't be found in the list called States. The function is looking for the States list in the current site - the same one where your NewForm.aspx lives.

Go to the States list, go into the List Settings, and click on each of the two columns. On the URL for the column settings page, you'll see a Query String parameter for the column name. Make sure the two parameters are Region and Title.

M.

Jul 21, 2011 at 11:12 PM

You were right all along. I appreciate the detailed reference so I watch for it on the many more applications ahead. next step is to apply it to a document library. Thanks Marc.

Coordinator
Jul 21, 2011 at 11:16 PM

What turned out to be the problem?

M.

Jul 25, 2011 at 5:36 PM

The staticname strikes again!

The label was being called and not the actual field name of the column. using the query string parameter I could easily identify the required field name and things quickly turned around.
Thus the actual application to the doc library was a success and we now have a more consistent filing process in sharepoint.

Thanks again for that last bit of clarity.

Feb 13, 2012 at 6:26 AM

Hi

 

Can someone helpme out with my prob please. 

I am using SharePoint 2010.

I have list A with some columns...Col1 Col2, Col3, Col4 and Col5.

ListB: I have 2 column in here --> Title( single line of Text) and Description( multiple line of text)

Ex:              Title                               Description

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

          Standard Term1                  a text of terms and conditions for Term1 ....................................

          Standard Term2                  a text of terms....................................................................................

In ListA-->  Col4 is a lookup to "Title" in List B

So when user select something from ddl in ListA; Col4., associated description text should showup in List A and should be editable.

 

Cheers

Coordinator
Feb 13, 2012 at 1:57 PM

remo1114:

It's always a good idea to start a new thread rather than tacking onto an old one.

It's a little hard to follow what you want to do, but SPCascadeDropdowns doesn't sound like the right function. I don't think any of the existing SPServices functions does exactly what you wont, but you could probably use SPDisplayReleatedInfo as a starting point and customize the script to your needs.

M.

Feb 14, 2012 at 12:56 AM

Thanks for your reply.

Coordinator
Feb 14, 2012 at 1:39 PM

remo1114:

Posting the same question on the SPDisplayRelatedInfo documentation page is actually going to get you less response. You should start a new thread in the Discussions if you want to get input. But like I said, there's no function that is going to do exactly what you want. You'll need to write some of your own script.

M.