Inconsistency when there are no child items

Jan 4, 2011 at 4:40 PM

I am using a cascading dropdown (which is pretty great, so thanks for providing it!).  Some of my categories have subcategories, some do not (and the subcategory field is not required). 

Users complained about having to double-click, so I added some extra scripting to render all dropdowns as simple dropdowns (found here: http://sharepointegg.blogspot.com/2010/10/fixing-sharepoint-2010-lookup-drop-down.html).  All was working well at that point.

You mentioned that you don't recommend using prompt text, as it gives users the opportunity to attempt to post an invalid selection.  So I set my prompt text to "", and now the first option in the subcategory field is selected (if there are valid options); the subcategory field is blank if not.  That is fine with me.

Everything works if all categories have at least one subcategory.  However, if I

1.) choose a category with no subcategories, then

2.) choose another category with subcategories,

the subcategories are not displayed.  If I then choose another category with subcategories, the subcategories are displayed correctly thereafter - they are only missing immediately after I choose a category with no subcategories.

Am trying to debug, thought you might have some pointers about where to look.

Thanks!

Jan 4, 2011 at 5:41 PM

Well, nevermind (again!!).  I think it has to do with the code which replaces the multiselect box with a simple dropdown.

My childColumnRequired field is undefined - if I set a breakpoint and force this condition: 

if(!childColumnRequired && (opt.promptText.length > 0)) childSelect.Obj.append("<option value='0'>" + opt.promptText.replace(/\{0\}/g, opt.childColumn) + "</option>");

then the subsequent cascade operation works.

Coordinator
Jan 4, 2011 at 8:40 PM

You've been busy! Maybe I should put you on thre SPServices payroll. Crappy pay, but the benefits are cool. ;+)

M.