May 10, 2011 at 3:14 AM

Hey Marc, as I commented on your blog post, I encountered one bug with this new function. I have a custom list with several columns that appear in this order on the form:

  • Title (single line of text)
  • State (lookup to "States" list)
  • City (lookup to "Cities" list)
  • Partner State (lookup to "States" list)
  • Partner City (lookup to "Cities" list)

I'm using SPCascadeDropdowns for State > City as well as for Partner State > Partner City. I'm also using the new SPComplexToSimpleDropdown on all four columns. All are required columns. For some reason the Partner State and Partner City columns don't pass validation. I'm using jQuery 1.3.2 as that is what's deployed to this particular environment. I haven't had a chance to try reproducing it in another environment, but I'll certainly try as soon as I can and let you know if I can reproduce the issue.

One other request for this new function: could you provide an option to create a blank default value for the simple dropdown that is rendered?

Consider when you create a Choice column with the drop-down control. You can make it a required field, and set it's default value to be blank. That way the end-user is forced to click the drop-down and select a value.

With a lookup column of less than 20 items, the default value is always the first item returned by the lookup; it's not set to be a blank value. If this field is required, the user could submit the form without ever having to make a selection or even look at the options in the simple dropdown.

SPComplexToSimpleDropdown creates the same simple dropdown; the default value is the first item in the array of items listed on the complex <input> element. It would be nice to prepend a blank <option> to the beginning of the simple dropdown so that if a user tries to submit the form without making a selection, the complex <input> only sees a blank value instead of being defaulted to the first item. It'd be just as if the user never typed anything into the complex dropdown <input>.

May 12, 2011 at 3:05 PM


Muchas gracias for this info. Sorry I haven't responded yet, but I've been tied up with some client work.

In my test environment, when I have a second lookup to the same list, it doesn't even have any values in the dropdown, so something's wrong. I'll try to figure that out as well as what you are seeing.

When you say "don't pass validation", do you mean that on submit, you get an error from SharePoint? Or is the error sooner than that?

On the blank default idea, I think that needs to be driven by however the original control is set. Since I simply pull all of the values from there, the settings for the column should be respected. The issue with adding any addtional values, even an empty one, is that will also cause a validation error if the user leaves it selected. It usually is a more ugly "An unepected error has ocurred" rather than a simple validation error, too.


May 12, 2011 at 5:02 PM

It doesn't pass validation when I submit the form. It acts as though the second lookup is empty and gives me the "You must select a value..." validation message.

You're right about inserting a blank value; I tried it and received the "An unexpected error has occurred" message. Too bad because it'd be nice to be able to require users to select a value. I suppose I could make it work by inserting a blank <option> and then using PreSaveAction to require users select something other than the blank <option>, but I'm not sure it's that big of an issue in my current project.

May 15, 2011 at 4:08 AM


I've been trying to sort out the issues here. It seems to be a problem where the script for the other complex dropdown(s) breaks if I hide the complex dropdown for the column I'm trying to work with. Net-net, I need to come up with a way to hide or conceal the complex dropdown SharePoint renders without breaking things, and it's proving tricky.

I'll let you know when I have a new iteration for you to try.


May 15, 2011 at 4:35 AM

Hmm, I can think of a few different methods to try concealing the complex dropdown. Not sure if they'll do the trick or not, but what about trying to use absolute positioning for the complex dropdown and position it off-screen? {position: absolute; left: -9999px;}

Or maybe it would work if it was simply transparent? (http://css-tricks.com/snippets/css/cross-browser-opacity/) It would still take up space on the page though...

Or if you set its height to 1px with overflow hidden {height: 1px; overflow: hidden;} that might work.

Some food for thought anyway...looking forward to the next iteration!

May 15, 2011 at 4:39 AM

The first option breaks the script, but the other ideas are good ones.

I had taken the simple route in the first iteration by just setting {display: none;}. Unfortunately, there's some pretty crufty stuff in Microsoft's script.

Stay tuned!


May 15, 2011 at 4:47 AM

p.s. I think that the issue is that the script is trying to set focus, and if the element isn't "there", there's an issue. I'm still trying to figure out why the script would try to set focus on an element it isn't actually acting on at the time, though.


May 15, 2011 at 12:20 PM

I just ran into a similar issue with 20+ ddl's.  I had two forms on the same page each with a 20+ ddl.  Given a certain interaction by the user, one of the forms would disappear using .toggle().  That uses display:none;.  What happened was the 20+ ddl, simply wouldn't work at all after one of the forms disappeared.  It literally made me have to rewrite the page.  I wish I thought about Josh's techniques, b/c it sounds like these would work.  

Hope you can nip this in the bud Marc.

May 20, 2011 at 3:53 PM

Try the new ALPHA: http://spservices.codeplex.com/releases/view/64390