This project has moved. For the latest updates, please go here.

SPFilterDropdown and how to get rid of (none)

Jul 11, 2011 at 10:17 AM


I am using SPFilterDropdown in a investment demand form. Here I have a field "Location" that depending on other fields should either be empty or then the user needs to choose one of the values. It should not be possible to leave location unselected if there are values you could select, but I also need to support the case where there are no choices.

If I set this field to be mandatory on the form, it works fine when there are locations, but then the user cannot save the request if the location list is empty. So it must be an optional field.

I know I can change (None) to a valid "no value" using the new noneText property. But what I also want is a way to get rid of this empty option completely so that a user cannot select it if there are other options to select.

An example of my problem, after making the other selections in the form there are three options in the list:

Factory 1
Factory 2

SharePoint will accept the empty selection but this is not a valid selection for the workflow. I guess I could write my own checker to complain when the form is submitted that the user needs to select a valid value, but a much better alternative would be if I could remove (None) and have just this

Factory 1
Factory 2

So basically make it act like the field was mandatory except when there are no options then (and then only) would it allow an empty selection.

Does anyone have an idea how to make this work? I have done scripting to auto-select the first valid value in the list, but the empty value is still there able to be manually selected.


Jul 11, 2011 at 5:59 PM


The "(None)" values is there to mimic the default SharePoint behavior. Since you are trying to make it conditionally available, I think you'll need to write some script of your own.

You could attach to the change event (assuming it's a "simple select") and build your logic into your script.