“Value is not among the set of valid lookup values” error saving a form in MOSS 2007

If you are using MOSS 2007 and you see “Value is not among the set of valid lookup values” error when you save a form, this is caused by a look-up field. Unfortunately, being an old system, SharePoint 2007 doesn’t render this type of field as a select HTML element. Instead it appears to be a textbox HTML element with some associated JavaScript events handlers. This means, an user can actually write down a value which doesn’t exist in the look-up list.


Now as you know where is the problem, you can restrict the user’s input by changing SharePoint:FormField control associated for the column with a SharePoint:DVDropDownList displaying values provided by a SharePoint:SPDataSource. So instead of having a code like this:

<SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="New" FieldName="InternalFieldName" __designer:bind="{ddwrt:DataBind('i',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@InternalFieldName')}"/>

you can a new code:

<SharePoint:DVDropDownList runat="server" id="ff1{$Pos}" DataSourceID="SPDataSourceId" DataValueField="ID" DataTextField="Title" __designer:bind="{ddwrt:DataBind('i',concat('ff1',$Pos),''SelectedValue','SelectedIndexChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@InternalFieldName')}" />

Please note the followings:

  • Drop down control is getting the data from an SPDataSource and data value field is ID.
  • Data text field is set to Title, but can be any other column from look-up list you want to display.
  • __designer:bind attribute was changed and ‘Value’ parameter changed with ‘SelectedValue’ and ‘ValueChanged’ was changed with ‘SelectedIndexChanged’.

I hope this will help you fixing the issue. In case you are planing to upgrade from MOSS 2007, you should not be worry about it anymore, as this was fixed. I checked on SharePoint Online, SharePoint 2013 and 2010 version.


Author: anvlpopescu

Nothing special to say. I'll think about it more and let your know.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s