Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a site dropdown column using a list as the datasource (lookup). I was looking for a way to have the column be both required and have a default blank value. I read that is is not possible without code. My workaround was to add an item to the source list called "(select a value)". When I add this to the list, the lookup column on the form defaults to a blank value instead of (select a value). When I remove the item from the source list, the default value is always the first item in the list: "Alden". I don't get it. It exhibits the same behavior for any new values I add to the source list.

Even stranger, if I delete "Alden" from the list, it selects the second (existing) item: "Ann Arbor". If I add "Alden" back, it selects it as the default.

It seems items added after I set the list as a source for the site column don't come up as a default value.

Hope that makes sense...

share|improve this question
    
I just though of something. Is it possible that some indexing has to run on the server first? –  Steve W Jul 18 '12 at 17:08
    
Hi Steve, instead of using the comment - you can update the update the question. –  spStacker Jul 18 '12 at 20:55

1 Answer 1

When rendering a mandatory lookup column SharePoint will render it as a HTML <select> with only the valid entries and no blank entry. It'll mark the current <option> with the attribute selected. If the current (default) value isn't in the list then no entry will be marked as selected. The browser will show the <select> as a dropdown with the <option> marked selected as the current item, if no <option> is marked selected it'll use the first item as current.

Your options are:

  • is either to make the lookup not mandatory of keep the "(select a value)" entry in the list. To prevent users from posting without a value you'll then have to have an event receiver which will show a very user unfriendly error or do followup either manually or with a workflow.
  • create a custom form

When you upgrade to 2010/2013 the first option and a validator will give a nice solution.

share|improve this answer
    
When I add the "(Select a facility)" as an entry in the source SP list the dropdown is attached to, the html of the dropdown shows as an <input> control but has events attached to it. when I delete the (Select a facility) item from the source SP list, the dropdown shows as a <select> control. This has me baffled... –  Steve W Jul 18 '12 at 18:18
    
This thread explains what is happening: sharepoint.stackexchange.com/questions/28300/… If there are more than 20 items in a SP list, the dropdown bound to the list is rendered as an HTML input control; if not, then it is rendered as a select control. It had nothing to do with the value I was entering, it was because it was the 21st item in the list. Also, it appears a side affect of the dropdown rendering as a HTML input control is the default value for the dropdown is blank. –  Steve W Jul 18 '12 at 19:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.