Working with SharePoint 2010 Column validation



One of the disadvantages when we work with SharePoint 2007 is the column validation but in 2010 it is fully resolved, ability to easily validate the column values entered into list items is a wonderful addition to SharePoint 2010. In this article I will show you 2 simple examples of how to use column validation; at the column level, then at the list level.

Before starting on it let me introduce another good feature of SharePoint 2010. If you want to create a unique column in SharePoint 2010, it is very easy you don't have to write an event handler or features like we do in 2007. While creating the column just click on Enforce unique Values: "Yes". You are done!!

Image1.gif

Column Level Validations

  1. Just create a column; Say Age. I want the users to enter only age 25 in the age column. So you can go down to the column validation section and can write
    [Age]=25 you done it will enforce for the age 25.

    Image2.gif
     
  2. Please find the Screen shot below

    Image3.gif
     
  3. You can find the Column level validation in Action

    Image4.gif

List Level Validation
  1. Now we move on to List level Validation

  2. Create two columns Named Start Date and End Date. Here I want to enforce a validation like End Date must be greater than or equal to Start Date
     
  3. Go to List Settings Click on validation Settings

    Image5.gif

  4. In the formula section give the formula as given below

  5.  =[End date]>=[Start Date]

  6. Give the error message also in the second column you have done

    Image6.gif
     
  7. You can see a list level validation in Action below

    Image7.gif

The formula Syntax is similar to what we use in calculated column in 2007. But one important thing to be noted that TODAY is not a valid validation formula. in 2010.