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

Issue with DVDropDownList

May 7, 2010 at 10:01 PM

To avoid the input box rendered when using a list larger than 20 items, i implemented a DVDropDownList in my EditForm.aspx page.

everything is working well, except for one thing:

the SPCascadeDropdowns function is not selecting correctly the previously saved item, so everytime i reopen a list, the value in the child column get populated with the very first available item in the filtered list, instad of picking up the correct value.

anyone was able to setup correctly SPCascadeDropdowns on a DVDropDownList ?

thanks in advance !

May 8, 2010 at 4:15 AM


The functions in SPServices are built to work with the default controls.  Once you start customizing the controls on the page, you'll need to make sure that they render the same HTML so that the functions can "find" what they are looking for.

In the case of SPCascadeDropdowns (and quite a few of the other functions, where they add to the functionality of dropdowns), the controls on the page are found with the following function:

 // Find a dropdown (or multi-select) in the DOM. Returns the dropdown onject and its type:
 // S = Simple (select); C = Compound (input + select hybrid); M = Multi-select (select hybrid)
 function dropdownCtl(colName) {
  // Simple
  if((this.Obj = $("select[Title='" + colName + "']")).html() != null) {
   this.Type = "S";
  // Compound
  } else if((this.Obj = $("input[Title='" + colName + "']")).html() != null) {
   this.Type = "C";
  // Multi-select: This will find the multi-select column control on English and most other languages sites where the Title looks like 'Column Name possible values'
  } else if((this.Obj = $("select[ID$='SelectCandidate'][Title^='" + colName + " ']")).html() != null) {
   this.Type = "M";
  // Multi-select: This will find the multi-select column control on a Russian site (and perhaps others) where the Title looks like 'Выбранных значений: Column Name'
  } else if((this.Obj = $("select[ID$='SelectCandidate'][Title$=': " + colName + "']")).html() != null) {
   this.Type = "M";
  } else
   this.Type = null;

So, as you can see, we're looking for a select with its Title set to the DisplayName of the column.  Your control will need to mimic that for SPCascadeDropdowns to work.


May 8, 2010 at 3:30 PM

thaks a lot for the quick response.

here's the code used for the creation of the field:


            DefaultValue="Sotto Tipologia"/>

Title="Sotto Tipologia"



so as u can see i was already providing the correct Ttile field.


Actually, the cascading actually works, but i figured out where the problem lies:

the DVDDropdownlist is populating my select with only Text Fields, without the corresponding IDs, so every time i reopen an object, SPCascadeDropdowns is unable to select the previously selected value, and instead shows the first element of the already cascaded field.

the only solution i could make it work is:
- store my text value before calling SPCascadeDropdowns
- lookup into my list via SPServices() and find the corresponding ID (assuming the titles are unique, which in my case is a bit of a risk)
- call SPCascadeDropdowns
- set back the correct value of the select field

of course a better solution would be to have the DVDDropDownList already populating my select with the correct IDs and Values, but i wasn't able to make it work.

any suggestions???

thanks again in advance

May 8, 2010 at 3:40 PM
Edited May 9, 2010 at 1:27 AM

Hmm. DVDropDownList is definitely not my bailiwick.  Can you post the rendered HTML from the DVDropDownList? There must be something different about it from the default dropdowns.

One of the old things in the Issue Tracker is Changing Cascaded Child Lookup Control into a standard dropdown.  I haven't done anything with it, but this might be a nice approach to implement.  Reading through the item, it's not exactly what I thought it was after all this time, BUT adding the capability to SPCascadeDropdowns to convert the "complex" input/select hybrid control to a plain old select would be a nice enhancement, and I think would accomplish what you are trying to do.


May 8, 2010 at 5:57 PM

yes, indeed -- adding the capability to SPCascadeDropdowns to convert the "complex" input/select hybrid control to a plain old select -- would be super!

and i think would grow the popularity of SPServices by a good measure. these days i was reading tons of blogs / articles explaining the most diverse and complex solution to get rid of the input/select, and reading a lot of peaople going crazy to solve this problem.

as of now, i got the problem fixed by using the 4steps approach i described before in my post, but for sure having to customize pages and web parts etc is not the easy and elegant way



May 9, 2010 at 5:42 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
May 9, 2011 at 7:44 PM


If you're still out there, take a look at my blog post today: New SPServices Function: SPComplexToSimpleDropdown. Finally got around to building something to help with this.