SPCascadeDropdowns - 1 parent; multiple children

Dec 21, 2010 at 7:54 PM

I am trying to use the SPCascadeDropdowns to populate 2 different children based on a single parent.  This is going to be used in a Migration Request site, so I have a drop down that lists all the systems and based on the system selected it will fill the "From Region" with the list of regions to select 1 (i.e. Development, Test, Training, Production) and also fill the "To Region" with the same list of regions to select multiples.  My code looks like the following:

	$(document).ready(function() {
		$().SPServices.SPCascadeDropdowns({
			relationshipList: "Regions",
			relationshipListParentColumn: "System",
			relationshipListChildColumn: "Title",
			parentColumn: "System",
			childColumn: "To Region",
			debug: true
		});
		$().SPServices.SPCascadeDropdowns({
			relationshipList: "Regions",
			relationshipListParentColumn: "System",
			relationshipListChildColumn: "Title",
			parentColumn: "System",
			childColumn: "From Region",
			debug: true
		});
	});

If works on the first list, but does not work on the second one. In the case above, I get the "To Region" with no problems,
but it ignores the second one.  If I rearrange them, then it will create the "From Region" properly, but ignore the "To Region"

Thanks,
Jeff Bradley

Coordinator
Dec 21, 2010 at 8:05 PM
Edited Dec 21, 2010 at 8:06 PM

Jeff:

I'll try to reproduce this on my end and let you know what I find. Are the "To Region" and "From Region" columns both Lookup columns into the same Regions list?

M.

Coordinator
Dec 22, 2010 at 12:28 PM

Jeff:

I've got a test for this up and running using:
jquery-1.4.2.min.js
jquery.SPServices-0.5.8.min.js

It seems to work OK. I'm using Country as my parentColumn, and then I have two region columns, To Region and From Region, as you've outlined above.  I tested in both Firefox and IE8.

If you can tell me more specifics about your setup, I'd be happy to try to help debug this.

M.

Dec 23, 2010 at 3:05 PM

Here is what I have found so far...

It works wonderfully in SP2007.  SP2010 is experiencing the effect I described in my original post.  I am not sure why SP2010 would treat it differently.

Coordinator
Dec 23, 2010 at 3:10 PM

Ah, OK. I didn't realize that you were trying this in 2010. I'll take a look.

M.

Coordinator
Jan 5, 2011 at 3:38 AM

Jeff:

I'm wading back through my emails and see that I left this dangling. Did you work it out or would you still like me to tak a look?

M.

Jan 5, 2011 at 1:54 PM
I made a slight change to the design (since the user can request a migration from one system to another system), I now have two different cascading dropdowns, instead of one dropdown driving 2 different children. I was not able to get the 1 parent, 2 children to work, but I no longer need that for this project.
Thanks,
Jeffrey Bradley
Coordinator
Jan 5, 2011 at 5:10 PM

OK, great. I'm glad I didn't hold you up. I'll add the 2010 situation to the Issue Tracker and see if I can reproduce it in any case.

M.

Coordinator
Jan 5, 2011 at 5:11 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Jan 11, 2012 at 7:00 PM
Edited Jan 11, 2012 at 7:00 PM

I realize that it's been a really long time on this, but I've got a fix for this in v0.7.1ALPHA8, which I've just posted.
http://spservices.codeplex.com/releases/view/77486

If you have a chance to try it out, please let me know how it goes.

M.

Jan 17, 2012 at 2:15 PM

I´ve tried the new version and it really updates both dropdownlists. But both dropdowns are showing the same list data now, though pointing to different lists.

Here´s my code:

$(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "{8C5FBCE1-6BC8-4D95-9E99-F418D3167700}",
   relationshipListParentColumn: "Klasse1",
   relationshipListChildColumn: "FullName",
   parentColumn: "Klasse",
   childColumn: "Schüler",
   promptText: "Auswählen...",
   selectSingleOption: true,
   debug: true
  });
 
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "{864CDC25-548B-47A3-AAAB-EE27B9DB1141}",
   relationshipListParentColumn: "Klasse1",
   relationshipListChildColumn: "Title",
   parentColumn: "Klasse",
   childColumn: "Fachunterricht",
   promptText: "Auswählen...",
   selectSingleOption: true,
   debug: true
  });

});

The update works, but both dropdowns get the list data from the first call of the SPCascadeDropdowns method.


  

 

Coordinator
Jan 17, 2012 at 3:19 PM

I can't seem to reproduce this. In my test, I've got a State column as the parent, with three child columns. Two of those columns lookup into the Cities list and show the cities for the chosen State. The third is a lookup to another list called Colors. Each returns what I expect. Here's my code in case it helps:

   $().SPServices.SPCascadeDropdowns({
    relationshipList: "Cities",
    relationshipListParentColumn: "State",
    relationshipListChildColumn: "Title",
    parentColumn: "State",
    childColumn: "City",
    debug: true
   });
   $().SPServices.SPCascadeDropdowns({
    relationshipList: "Cities",
    relationshipListParentColumn: "State",
    relationshipListChildColumn: "Title",
    parentColumn: "State",
    childColumn: "Second City",
    simpleChild: true,
    debug: true
   });
   $().SPServices.SPCascadeDropdowns({
    relationshipList: "Colors",
    relationshipListParentColumn: "State",
    relationshipListChildColumn: "Title",
    parentColumn: "State",
    childColumn: "Color",
    selectSingleOption: true,
    simpleChild: true,
    debug: true
   });

M.

Coordinator
Jan 17, 2012 at 3:38 PM

I added a fourth relationship to see if that broke it, but it still seems to be working:

   $().SPServices.SPCascadeDropdowns({
    relationshipList: "StateCity",
    relationshipListParentColumn: "State",
    relationshipListChildColumn: "ThisState",
    parentColumn: "State",
    childColumn: "ThisState",
    debug: true
   });

I wonder if the language is causing an issue?

M.

Jan 31, 2012 at 7:29 AM

I added another list and replaced the one with the mutated vowel. But the effect is the same. This is my scenario:

I have a list called "students" with a lookup field to a list called "Klassen" and a second list "Unterricht" with a lookup to "Klasse" (internal field name "Klasse1"), too.

"Klassen" itself consists of "Title" and "Klassenlehrer".

Here´s the code I included into PlaceHolderMain:

<script language="javascript" type="text/javascript" src="../../Scripts/jquery-1.6.4.min.js"></script>

<script language="javascript" type="text/javascript" src="../../Scripts/jquery.SPServices-0.7.1ALPHA8.js"></script>
<script language="javascript" type="text/javascript">
    $(document).ready(function() {
        $().SPServices.SPCascadeDropdowns({
            relationshipList: "Students",
            relationshipListParentColumn: "Klasse",
            relationshipListChildColumn: "Title",
            parentColumn: "Klasse",
            childColumn: "Student",
            promptText: "...",
            selectSingleOption: true,
            debug: true
        });
   
        $().SPServices.SPCascadeDropdowns({
            relationshipList: "Unterricht",
            relationshipListParentColumn: "Klasse1",
            relationshipListChildColumn: "Title",
            parentColumn: "Klasse",
            childColumn: "Fachunterricht",
            promptText: "...",
            selectSingleOption: true,
            debug: true
        });
    });
</script>

 

If I call only one of the two SPCascadeDropdowns methods they both work. If I use both, both dropdownlists are populated with the list data of the second call.

Kathrin

Coordinator
Feb 1, 2012 at 1:00 PM

Kathrin:

I'm not sure what's happening for you. If it's possible for you, can you send me your lists saved as templates? I could try to rig up the same structure in my environment to see if I could reproduce it.

M.

Feb 6, 2012 at 1:50 PM
Edited Feb 6, 2012 at 1:58 PM

hi sympmarc,

 

i have 1 parent list and 6 child lists and have lookup of parent  in every 6 child lists, its just support three child list, if i add one more method for fourth child list it does not behave any thing, i does not show expected result for all 6 child lists(6 Drop downs).

suppose i have i selected parent dropdown then after selection the all 6 child drop down  should be fill 

does it support more then three list, please advice me what should i do

 

thanks in advance 

Coordinator
Feb 6, 2012 at 2:03 PM
Edited Feb 6, 2012 at 2:03 PM

wasi:

As I noted above, I've had up to 4 child lists with no issues. Make sure that all of your options are set correctly.

Also, keep in mind that each parent/child relationship will fire Web Services calls, so even if it works, it may make for a sluggish page.

M.

Feb 6, 2012 at 2:09 PM

thank you very much for reply, one more thing i like to ask, when i going to select value from dropdown it show title of the control like this (Physical_x0020_Location_x0020__x0028_Master_x0020_Copy_x0029_) how can i hide this for enduser

Coordinator
Feb 6, 2012 at 2:44 PM

wasi:

I'm not sure why you are seeing that. It isn't something that SPCascadeDropdowns should be putting on the page.

M.

Feb 10, 2012 at 1:27 PM

hey marc,

I finally changed the structure of my lists to avoid the problems with updating two lists by one parent. Now I cascade the updates one by one and everything works fine. Thanks for your help!

Feb 12, 2012 at 11:50 AM
Edited Feb 12, 2012 at 5:03 PM

Hi marc,

 

its perfectly working when i add new item, but when i login with another id and edit the form then cascading  does not working and also does not show values on display form

what happend please advice me

Thanks

Feb 12, 2012 at 5:03 PM

is there anyone who can help me

Coordinator
Feb 12, 2012 at 8:57 PM

wasi:

It sounds like the other user probably doesn't have read permissions on the relationshipList(s).

M.

Feb 13, 2012 at 5:55 AM

Thanks marc for reply, i have a field called contributor where i have set event handlers for item level permission where i define users who would have contribute rights, then i login with those users the display form does not show values as i have filled the form as an admin, even i have checked some other lists on those list i have not implemented event handlers but same situation with those list.

 

Thanks

Coordinator
Feb 13, 2012 at 11:42 AM

wasi:

Do your users have read permissions on the .js files? If so, have you debugged to see what errors may be occurring in the network traffic?

M.

Feb 13, 2012 at 11:52 AM

thanks marc for reply. should i assigned rights to users on js file. users have no rights on js files and i did not debug it 

Feb 13, 2012 at 12:26 PM

marc:

should i add scripts on display form also. or how to test display form with another user

Coordinator
Feb 13, 2012 at 12:48 PM

Anyone who is using the form must have at least read permissions on the .js files, wherever you've stored them.

As for the display forms (DispForms), cascading there doesn't make any sense; they don't provide editing capability.

M.

Nov 21, 2013 at 2:39 AM
hello marc:
was wondering if there was any update on this.
Using 2013.01 with jQuery 2.0.
1 parent with 2 child look-ups on a custom new form.
Works fine on a custom edit form.
On the new form only works with the first child, even if I switch the order.
Tried removing the tab function, still no luck.

Any thoughts would be greatly appreciated.
Thank you.
Coordinator
Nov 21, 2013 at 7:03 PM
mcburley:

I don't test with jQuery 2.0 because I recommend against using it, but sticking to the 1.x branch for support for older versions of IE.

In any case, it should work exactly the same on an EditForm as it does on a NewForm.

Can you show me your code?

M.
Nov 22, 2013 at 1:20 AM
Edited Nov 26, 2013 at 12:21 AM
I’ve tried with various version of jQuery 1.10.x and 1.9x , same behavior.

Ultimately I need 1 parent and 4 children, which the same code below works on the edit form.
The new form has a tabs function and some conditional hides.
I stripped it down to just the code below, again same behavior.
<script type="text/javascript">
$(document).ready(function() {

$().SPServices.SPCascadeDropdowns({
                relationshipList: "{D91E86EC-A392-406F-9247-8FD866E9FBE2}",
                relationshipListParentColumn: "Organization",
                relationshipListChildColumn: "FullName",
                parentColumn: "Organization",
                childColumn: "Primary Contact",
                debug: true
});

$().SPServices.SPCascadeDropdowns({
                relationshipList: "{D91E86EC-A392-406F-9247-8FD866E9FBE2}",
                relationshipListParentColumn: "Organization",
                relationshipListChildColumn: "FullName",
                parentColumn: "Organization",
                childColumn: "BidSubmitContact",
                selectSingleOption: true,
                debug: true
}); 

$().SPServices.SPCascadeDropdowns({
                relationshipList: "{D91E86EC-A392-406F-9247-8FD866E9FBE2}",
                relationshipListParentColumn: "Organization",
                relationshipListChildColumn: "FullName",
                parentColumn: "Organization",
                childColumn: "PreBidStartMeetingContact",
                selectSingleOption: true,
                debug: true
}); 

$().SPServices.SPCascadeDropdowns({
                relationshipList: "{D91E86EC-A392-406F-9247-8FD866E9FBE2}",
                relationshipListParentColumn: "Organization",
                relationshipListChildColumn: "FullName",
                parentColumn: "Organization",
                childColumn: "PreBidMeetingContact",
                selectSingleOption: true,
                debug: true
});

}); //End DocReady 

 </script>
Feb 3 at 1:13 AM
Hi Mcburley,

Did you find a solution to your issue?
I am facing, what seems like, the exact same issue?

The first "spcascadedropdown block" works but the subsequent 2 don't?
I am using jquery 1.10.2 and spservices-2013.02a

Swapping the blocks around, makes not difference, as mentioned above, the first one always works but the subsequent 2 don't?

code below:

<script type="text/javascript" >
$(document).ready(function() {
 
$().SPServices.SPCascadeDropdowns({
relationshipList: "TTR",
relationshipListParentColumn: "Location",
relationshipListChildColumn: "Title",
parentColumn: "Location",
childColumn: "TTR",
simpleChild: true,
debug: true

});

    
$().SPServices.SPCascadeDropdowns({
relationshipList: "TTD",
relationshipListParentColumn: "Location",
relationshipListChildColumn: "Title",
parentColumn: "Location",
childColumn: "TTD",
simpleChild: true,
debug: true

});

$().SPServices.SPCascadeDropdowns({
relationshipList: "DeptUsrLookup",
relationshipListParentColumn: "Locations",
relationshipListChildColumn: "Title",
parentColumn: "Location",
childColumn: "Department",
simpleChild: true,
debug: true

});
});
</script>
Coordinator
Feb 3 at 4:07 AM
Anthony:

Any chance you're on Office365?

M.
Feb 3 at 9:03 PM
Hi Marc,

No, not Office 365, and sorry I should have added a bit more detail.
SP 2010 foundation (on premise),
Custom new form,
One further detail that I can add is the "location" field, used for the parentColumn in all three blocks is a lookup field too?
I'm not sure if this makes a difference as the cascade works as expected on whichever block I put first in the script?

Many thanks for replying,
Anthony
Feb 3 at 9:33 PM
My issue is occurring on an Office 365 instance. I have not been able to resolve.
Feb 4 at 2:06 AM
Oh no!
Out of interest, Is your parentColumn "organization", a lookup field or choice field?
Feb 4 at 12:36 PM
Yes. Maybe something to do with a reserve or key word?
Mar 18 at 1:45 PM
Hi all,
I'm experiencing the same exact issue. Has anyone found/used any workarounds? Just curious, I'm using site columns as the lookup columns, I'm not sure if that has anything to do with it..
Coordinator
Mar 18 at 2:02 PM
xavierz007:

There are several issues above. Why don't you start a new thread with the specifics of what you are seeing so that we can discuss it.

M.
Mar 18 at 2:50 PM
thx Marc, will do