This project has moved and is read-only. For the latest updates, please go here.

SPCascadeDropdowns - childColumn & relationshipListChildColumn from same lookup?

Oct 16, 2009 at 2:34 PM

I'd love to use this but I think I'm going to stumble at the prerequisite - "The dropdown for childColumn is a lookup into relationshipList's relationshipListChildColumn column".

The relationshipListChildColumn values are not unique to any one relationshipListParentColumn
X - A
X - B
Y - A
Y - B
Therefore I can't use relationshipListChildColumn as the lookup for childColumn in the main list (would show A,B,A,B as four options).
I have 3rd List with a '3rdListColumn' and both childColumn and relationshipListChildColumn are lookup's on it. 

Any ideas?

Oct 16, 2009 at 2:40 PM
Edited Oct 16, 2009 at 4:08 PM


You may want to break your single list out into several lists.  You should think about this the same way you think about relational database tables (assuming you sit around and think about relational database tables).  It's a little hard to follow what your list structures are.  Can you reply back with the column names for each list involved?  I'm sure we can get you up and running.


Oct 16, 2009 at 3:11 PM

M, Thanks for quick response.

Essentially I've got a main list (TheMainList) which is where I need the cascade drop downs (NewForm, EditForm).
This contains two drop downs: -
DropDown1 - Containing values Bob, Marc and Fred (a lookup on List TheNamesList) 
DropDown2 - Containing values A through to Z (a lookup on List TheAlphabetList)

I then have a relationship list (theRelationshipList) which again contains two drop downs: -
Parent - Containing values Bob, Marc and Fred (a lookup on List TheNamesList) 
Child - Containing values A through to Z (a lookup on List TheAlphabetList)
For Example: - 
Parent  Child
Bob       A
Bob       B
Marc     A
Marc     C

My understanding is that 'TheMainList - DropDown2' should be a lookup on 'TheRelationshipList - Child' but the values aren't unique (too many A's), hence the requirement for 'TheAlphabetList'.

I'm hoping there's still a way of getting this working as there is still a link between 'TheMainList - DropDown2' and 'TheRelationshipList - Child', although via 'TheAlphabetList'.

Hope this makes sense


Oct 16, 2009 at 3:49 PM

Should probably add that it very nearly works.

If DropDown1 contains Bob then DropDown2 contains: -

Oct 16, 2009 at 4:11 PM

Must be my Friday brain, but it seems like this ought to be working for you.  You don't actually see the 0;# part in the dropdown, do you?


Oct 16, 2009 at 4:15 PM

Yes, I see the 0;# part in the drop down and the selection isn't saved (shows as blank in DispForm).

Oct 16, 2009 at 4:18 PM

OK, that's certainly a problem.  Can you post your jQuery for the function call?  I'f you'd rather take this offline: marc [dot] anderson [at] sympraxisconsulting [dot] com.


Oct 19, 2009 at 3:01 PM

When pulling from calculated columns or columns that pull from other lists, the ";#" notation will always rear it's ugly head (I think it has to do with MS's custom SELECT which attaches the FK table ID for easy retreival).  My workaround had been to alter the cascading dropdown function slightly.  Something like this . . .

var optionToAdd = "<option value='" + $(this).attr("ows_ID") + "'>" + $(this).attr("ows_" + opt.relationshipListChildColumn).split(";#").pop() + "</option>";

. . . where the underlined code strips the ID if it's there and doesn't cause an error if it's not present.  This is for display purposes only.  (See the multi-select ramblings on this Issue Tracker discussion)


Oct 19, 2009 at 3:34 PM

sympmarc - Thanks for all your help with this.

My brain temporarily slipped into gear over the weekend and I managed to get this working. The fix was along the lines suggested by toadmyster (thanks) but you have to drop the $(this).attr("ows_ID") altogether and use both parts of the   <id>;#<value>  contents of the (this).attr("ows_" + opt.relationshipListChildColumn).
e.g.   You get something like   65|23;#SomeText    but you need to have    23|Some Text.

Had to make some further changes to remove the "(none)" or "Choose <>...." options to fit my specific requirements.

Works a treat, highly recommend this to others.