.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Field validation failure on not required/blank drop-down box

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :SharePoint

I have a column in my list that is based on the records in another SharePoint list. When I try to edit a record in Datasheet View, I frequently get the following validation rule failure message:

The text entered for Client Impacted isn't an item from the list. Select an item from the list, or enter text that matches one of the listed items.

Even though the column appears to be blank to the naked eye, when you double click in the column, it selects what appears to be a space character and when you hit the delete key, it now passes the validation rule. So, my assumption is that the validation rule is saying something like "Space character isn't in the list, so you can't save the record..." Here's what's odd. I do NOT get the same validation rule warning when I edit in standard view and I know for sure that the column has not been erroneously filled with a space character. Anyone have any idea what might be going on here?

Thanks in advance for your help.


View Complete Post

More Related Resource Links

Server-side validation on an Entity Framework required field (property) does not work!

Has anyone had issues getting server-side validation on an Entity Framework required field (property) to work? The data type is a string (nvarchar). Server-side validation for required fields of other data types WORK fine. Only string fields have issues. I get the following error on UpdateModel(obj); of my POST method within the controller. Exception Details: System.Data.ConstraintException: This property cannot be set to a  null value.Source Error: Line 4500:                OnTextChanging(value);Line 4501:                ReportPropertyChanging("Text");Line 4502:                _Text = StructuralObject.SetValidValue(value, false);Line 4503:                ReportPropertyChanged("Text");Line 4504:                OnTextChanged(); I've even tried data annotations like this but it seems to get ignored.     [MetadataType(typeof(ObjMD))]     public partial class Obj     {    

how to do a ajax integrated validation in required field sharepoint newform.aspx

hi all, i have newform.aspx in sharpeoint list where in i have 2 cols which are reqd field. how would i make the server side validation without refreshing the page.. can i put it ajax update panel ?  how would i achieve this requirement.jayaraja

Required Field Validation on Tabbing


Hello Friends,

I have Textbox-A and Textbox-B. Textbox-A is mandatory. 

If a user comes to Textbox-A and without entering anything if he moves to next available control (Textbox-B) either by tabbing or by moving the cursor,

error message should be displayed.

Could anyone of you please help me by telling in which event to write the validation.

Looking forward to hear from you ASAP.

Thanks in Advance


Required Field Validator and drop down list


 I am trying to get the required field validator to work. I have given it an initial value of the first index value in the dropdown list. I is just not working. Will my contrrols residing on a View of a Multiview control effect anything. I am using all drop down lists?

How to localize "field is required" validation error message in mvc musicstore sample

I tried to localize codeplex mvc musicstore sample in .NET 3.5
I replaced "field is required"  message in all files with localized text.

In login of register screen, if some fields are empty, pressing enter still shows english language text like

The UserName field is required.

How to localize this validation message ?


FormView Text Field Being Set by A Drop Down List


Hello, I have a FormView which is used to insert a record into a database.  Outside of this formview i have a drop down list, I want to grab the value from that drop down list and set one of the text fields within the formview to it's currently selected value.  I've tried the following code, but the dynamic categorytextbox line is what seems to not be working.

                    <asp:DropDownList ID="ddlCategory" runat="server" AutoPostBack="True" 
DataSourceID="SqlDataSourceCategory" DataTextField="CategoryName"
DataValueField="CategoryID" Width="200px">

                            <asp:TextBox ID="CategoryIDTextBox" runat="server" 
Text='<%# Bind("CategoryID") %>' Visible="False" />

        protected void FormView1_DataBound(object sender, EventArgs e)
dynamic varCategory = ddlCategory.SelectedValue;
dynamic categoryTextBox = FormView1.FindControl("CategoryIDText

While Printing an Infopath Form it Prints lot of Blank Spaces Before RichText Field


I had an infopath form with few rich text field. When i copy some content from somewhere and paste in the richtext Box then while Printing the form I get Lot of Blank Spaces Infront of the rich text box.

I tried creating teh print view too but still i get bunch of empty pages printed before by richtext box control.

Is there a way we can remove those blank spaces.....

I am not able to find out what is going wrong here....

Video: Field and List Item Validation in SharePoint 2010

SharePoint supports the ability to create Excel-like field validation formulas to validate field data in a list, which greatly reduces the amount of custom code that a developer must create and deploy. (Length: 1:44)

SharePoint leaving Assigned To field blank in a Workflow Task



We are having an issue with occasional Tasks being created by a WF that have a blank Assigned to field.  Solution consists of:

  1. A form with a People picker field that allows the user to select and validate the Authoriser name.
  2. An Auto-start-on-New SP Designer workflow runs that does a "Collect Data from User action" and assigns the Task to the Authoriser.

Unfortunately, although this worked fine during dev and test, now the solution is live and we are having 150-200 requests per day, we are finding that the WF occasionally fails to fill in the Assigned To details when it creates the Task. (approx 8 failures per 200 requests, ie 4%).

As SharePoint already has the User data field, I am confused why this might fail, and there is no obvious pattern (same auth, 4 work OK then 1 failure). 
Does SP contact the AD again when it creates the Task?

Anything else I should investigate? any suggested fix / work-arounds?


Ruth, UK

How to use server side validation to ensure image field is not null


I'm having trouble accomplishing the above. Below is all the mark up and code. I'm not getting error messages, but the validate image function is not working (fileupload portion is working ok).

In my attempt below---not sure if it's the simplest or best validation approach anyway---the "UserId" parameter appears during rendering to be empty---but in most methods I have it successfully containing or referring to the logged-in user's identification.

Following is the control that refers to the image field (page = advertisement.aspx):

<asp:Image ID="Image" runat="server" ImageUrl ='<%#Eval("UserId","Image.aspx?UserId={0}") %>'


Following is the successful code behind for the page image.aspx referred to above (page = image.aspx.vb):

Partial Public Class Image

    Inherits System.Web.UI.Page

    Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Request.QueryString("UserId") IsNot Nothing Then

            ' Get the connection string from Web.config.

            Using conn As New Sq

Creating a custom drop down field type with SelectedIndexChanged Event

Hi All, I am trying to create a custom drop down field type and I was able to acheive that using the MS link http://msdn.microsoft.com/en-us/library/bb861799.aspx. As per the link, once the custom field is created we can override the "Validate" method to write the Validation logic and that works fine for me too. However I am facing a challenge even before going to Validate . Let me explain my actual requirements here. I need to build a custom drop down field and expose the field to the user in "Edit Properties " Page of a document library. Along with this field, I will be having some OOB site columns in the Edit Properties Page (Ex: Title, Subject etc)  . When user selects a value in the drop down, I need to hide/show few OOB site columns based on certain criteria.  I am facing a challenge of how to capture the "SelectedIndexChanged " event for the Custom drop down field in Sharepoint (Can we wire the SelectedIndexChanged event to a custom dropdown field type) ? Is this acheivable in SP 2010 Custom field type ? If so, how can I do it ? Can any of you kindly help me here?   Regards, Yesh

DataGrid exception on validation failure (DeferRefresh is not allowed...)

In the same series as the DataGrid validation scheme issues, I get an exception when a cell is invalid the DataContext changes This happens in a DataGrid, which is bound to a CollectionViewSource. This CVS itself has a DataContext bound to the currently selected product of a ListBox. So we are editing the details of product, those details include a data list in a DataGrid (DataGridTextColumn in this case). Either by using a data type that implements IDataErrorInfo or by using a ValidationRule, if the validation fails the DataGrid reacts by keeping the TextBox and showing a red box around it (when the validation is OK, the cell is tranformed back to a TextBlock). Nothing prevents me from selecting another product. The DataGrid then shows the new data and everything is fine. But if I come back to the product which failed validation, I get this exception: InvalidOperationException, 'DeferRefresh' is not allowed during an AddNew or EditItem transaction. How can I prevent that? What is the correct way of cancelling the edit on that faulty cell when another product is selected, or when the DataContext changes? I can detect those events, but CancelEdit() doesn't work on the DataGrid (no result). I'm using .NET 4.

Compare Validation for the Title field of the list

Hi, I do have a field known as 'Title' in the list.My requirement is there should be not be any duplicate values i.e first time if i enter say 'test' in Title field it should save where as second time when i enter same text as 'test' it should show message as 'item already exists with the Title that you have entered'.Ofcourse i should do the compare validation over here but just let me know how to do this Thanks & Regards, Sudheer

attachment disappears when evaluating the required field in sharepoint list

hi all, i have a sharepoint list with soem required fields . when i do the attachement and say ok without entering the required fields in the page . the page refreshes and prompts me to enter the required fields. but the attachemnt disappears. i need to re attach the files aggain.. wats the fix for this ?jayaraja

AJAX ComboBox - required field validator

Hi All, I want to put validation on a combobox to ensure user selects/enters a value. I've tried using a the standard required field validator which doesn't work. So I would like to do the validation using javascript/jquery. Not sure how to approach. When I look at how the combo box is rendered, it appears as a unordered html list. There is also a hidden field but this always seems to be set to 0. So is it possible to do this validation client side. I've read so many posts about this but I havn't got an answer yet. Am I on the wrong path here? Any ideas? Thanks

Display each new line of a sharepoint mutliline text field as choice in drop down box.

The question pretty much says it all. I have a lot of data I need to represent, and this would be the best way to do it. I have a multiline text field in sharepoint, where each line has a choice that should be a seperate choice in a text box. How do I do this? I have the data connection set up, and I would be fine with adding some sort of tag after each line, if that would make it so infopath can somehow parse out those tags, and interpret each "chunk" as a choice. Thanks in advance for your help.

How do i do Validation on a field ?

Team, I have a situation where i need to do validation on a form field. If field A is Yes, Make field B mandidatory(should not be left empty). How can i achieve this? I want to make these changes through sharepoint designer code. Bhadram.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend