Saturday, January 2, 2010

Field and List Item Validation in SharePoint 2010 Lists

In SharePoint 2010 now you can validate the list column values before saving to list. Field Validation allow you to specify the FORMULA that you want to use to validate the data column when new items are saved to the list. The formula must evaluate to TRUE for validation to pass. To show this new feature in action  i am going to add new column to my existing SharePoint List called  Contacts.

Here is the my List

image

In this existing  list i am going to add a new column called  Age and  I wanted allow user input a Age in between (1-100). if Age value not in-between 1-100 i will display the error message saying please enter age [1-100].

To add or Create new column click on Create Column as shown below.

image

Now Enter the Column name and select Type .

 

image

Now expand column validation and provide formula

image 

=AND (Age>0 , Age<=100) is the formula to validates the Age column.

image

if user enter 0 for  age column  then the error message is displayed as shown below.

image

List Field validation is a cool new feature in SharePoint 2010 and this reduces  developer job writing validation code  .

Nandri(Thanks)

SreenivasaRagavan

No comments: