Issue with SPCascadeDropdowns.

Jul 11, 2012 at 9:35 PM
Edited Jul 11, 2012 at 9:45 PM

I'm using a collection of 4 drop downs that are linked together. Whenever the user changes the top dropdown, I use the following to clear out any selected values. 

function clearOptions() {
ddField1.attr('selectedIndex', 0);
ddField2.attr('selectedIndex', 0);
ddField3.attr('selectedIndex', 0);

This is needed because I also have a script that is hiding/revealing the rows depending on which main option is selected. So I don't want the user to set a value, change the main, then once they submit have the old hidden value sent.

Regardless, when the user changes the main and that function runs to reset the selected options. It doesn't reset the dropdown filtering! So even though all the selected values are at "(None)" or "Choose Value", if you skip down to the last dropdown, it still has all the items that were enabled before changing the main and resetting the selections.

I have to select the value above it, pick a different value other than (none), then click it again and re-select (none). Then the filtering is back. It's like using javascript to change the selected index isn't firing the event. Only a user select will...

What can I do about this?

Jul 12, 2012 at 1:25 AM

If you are using dropdowns that are Lookup columns, SPCascadeDropdowns will clear the children for you when you make a change to a parent. It sounds like you are using some other control, maybe a custom dropdown? The dfuncxtion may not work with those, as it looks for specific markup in the form page.


Jul 12, 2012 at 1:43 PM

Thank you for the reply. 

All of the columns are Lookup except the top one which is a Choice. Not really sure what a custom dropwdown is, so I don't know if any are. Though I don't see any reason why I couldn't just change the Choice one to a Lookup also. I'll give it a try.


Jul 12, 2012 at 1:46 PM

The function doesn't work with a choice column. Check the docs for the proper setup. You have to have the relationships set up vis Loomups columns for each "cascade".


Jul 12, 2012 at 2:05 PM

Wow, thank you for the fast reply.

So I have them all as lookups now. And it "sort of" does what I want. If the main drop down selected doesn't allow for the value that has already been selectedthen it will reset the list. However, if the value is allowed, it doesn't. This normally wouldn't be a problem but I run into issues because, let's say the main option just has two choices. A or B. A reveals dropdowns C, D, and E to report on a specific issue. But B only reveals dropdown C for a general issue.  If I first select A, then set C, D, and E to some values, then switch from A to B, nothing get's reset because the the value in C is still allowed in B. But the rows are now hidden so when it's submitted they are stored.

Is there anyway to just force it to reset all the boxes below whatever dropdown is being selected, regardless of whether the options already below are legal?

Jul 12, 2012 at 2:05 PM
Edited Jul 12, 2012 at 2:05 PM

*double posted*

Jul 12, 2012 at 2:09 PM

It sounds like you may have duplicate values in your relationship lists? If that's the case, then you'll see what you describe.


Jul 12, 2012 at 2:13 PM
Edited Jul 12, 2012 at 2:22 PM

Do you mean the values that allow an item to be revealed? Because that would be correct. Every item in Option B has all the options of A added to it, Done so that A could be a Lookup and tied in as well. Might just need to rethink my approach here.

Edit: I added back the little reset function as well and now it seems to be working great! Changing the top one resets all the values regardless and if you skip down there aren't any that a secretly set behind the scenes. 

Not going to argue with it, it works and that's good enough for me.

Thanks for your help!

(Though you haven't seen the last of me, I'm sure I'll be back in a bit to figure out why on another form CAML query just keeps saying either the column can't be found or the query is incorrect) :)