“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.

MOSS2007-lookup-error

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.

Advertisements

Internet Explorer 10 stop working on SharePoint pages

Recently, I was facing an Internet Explorer 10 issue on some SharePoint pages. I was simply prompted by the system to close the program or debug it. I don’t know what exactly cause the issue, but I found the solution. I simply read the error logs and I discovered the error details.

IEXPLORE.EXE
10.0.9200.16720
523cf127
OLEAUT32.dll
6.1.7601.17676
4e58702a
c0000005
000046b1
4ec4
01ceeaa102273140
C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE
C:\Windows\syswow64\OLEAUT32.dll
4bea6f77-5694-11e3-94f6-b8763fe03abf

To solve this issue, type CMD in run to open command prompt window. Then navigate to “C:\Windows\syswow64” directory by typing cd C:\Windows\syswow64\OLEAUT32.dll and register again the dll file (command: regsvr32 OLEAUT32.dll).

No access to SharePoint online log

Yesterday, I have decided to buy a subscription for Office 365 SharePoint Online. My developer’s subscription expired and there wasn’t any way to prolong it. So I choose a plan and paid only around 7 EUR, as I have only one user for SharePoint.
This being done, I started to customize my page on the website accessible for public. Once I did a mistake, I received a correlation id. As all developers, I tried to see if there is any way to have access to the log and I ended raising a service request to Microsoft. But, surprise… answer come quick. If I want to know what is behind that correlation id, I need to provide a business justification to Microsoft and server administration will give me requested information.
I really hope Microsoft will provide soon a way to access errors. I am wondering how developers for Office 365 are creating application for SharePoint online. Probably they are doing “blind” development. 🙂

Custom form slow performance

Recently, I have discovered some performance issues with custom forms created with SharePoint Designer. Mysteriously, form was slow even for adding new records to the list.
Looking into the code created by SharePoint Designer, I discovered that new form was based on SPDataSource with ListItem mode set and CAML was getting all data from the list.

<SharePoint:SPDataSource runat="server" DataSourceMode="ListItem" SelectCommand="&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=&quot;ContentType&quot;/&gt;&lt;Value Type=&quot;Text&quot;&gt;Item&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;/View&gt;" UseInternalName="True" ID="Service_x0020_List_x0020_Marcom1">
<SelectParameters>
         <WebPartPages:DataFormParameter ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="" Name="ListItemId" />
        <WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{036D8075-3258-4DA2-8804-52897332DD3E}" Name="ListID" />
</SelectParameters>
</SharePoint:SPDataSource>

Analyzing CAML select command, I realized SPDataSource is getting all rows from Item content type. For a custom list this probably means all rows. So, I decided to change it.

<SharePoint:SPDataSource runat="server" DataSourceMode="List" SelectCommand="&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=&quot;ID&quot;/&gt;&lt;Value Type=&quot;Counter&quot;&gt;{ItemId}&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;/View&gt;" UseInternalName="True" ID="Service_x0020_List_x0020_Marcom1">
<SelectParameters>
         <WebPartPages:DataFormParameter ParameterKey="ItemId" PropertyName="ParameterValues" DefaultValue="" Name="ItemId" />
        <WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{036D8075-3258-4DA2-8804-52897332DD3E}" Name="ListID" />
</SelectParameters>
</SharePoint:SPDataSource>

What I changed:

  • SPDataSource was set to List mode from ListItem.
  • CAML was changed and filter was applied on ID field.
  • ListItemId parameter was changed to another one. I called it ItemId, but you can choose different names. Is also a good idea not to bind this parameter to ID query string.

Applying this changes results in speed increase. Try it and you will see. Don’t let SharePoint Designer control you.

An error 0x800A0CB3 occured. No further information was provided.

I noticed this error once on a Windows 7 x64 operating system with an Office 2007 x32 installed. I have searched the internet for a solution, but nothing solved by problem. And finally I found an article on this link.http://support.microsoft.com/kb/255707.

The solution was not provided directly, but it gives the idea it has something to do with OLE DB drivers. Installing Microsoft Access Database Engine 2010 Redistributable solved my issue. So, if you will see this error, you can try my solution. Please drop me a note if your issue is not solved.