This SharePoint tutorial contains a few SharePoint 2013 list column validation examples. After reading this tutorial, you will get to know how to implement list column validations in SharePoint Online or SharePoint 2013/2016.
Here I have explained, 5 SharePoint list column validation examples.
SharePoint Tutorial Contents
- SharePoint list column validation example-1
- SharePoint list column validation example-2
- SharePoint list column validation example-3 (First name and Last name should not be same)
- SharePoint list column validation example-4 (Date should not be less than today)
- SharePoint list column validation example-5 (Length Should not be greater than N characters)
We will see a few examples of how column validation works for a particular item in the SharePoint List.
Here my requirement is I have a SharePoint 2013 list which contains a Title column, I want user should be able to put only “Mr” or “Mrs”. If users put something else other than this, then it should give an error message saying You can put only Mr or Mrs.
To use validation for a particular column, follow the below steps:
Open your SharePoint List, then go to List Settings. In the Settings page, go to the Columns section and then click on the particular column for which you want to use the validation. In my case, it is the Title Column.
This will open the Edit Column page, here click on “Column Validation”. The in the Formula box put like below:
And in the User message, put the message which the user wants to see if the validation fails like: “Please only put Mr or Mrs”. The formula should look like below:
Then click on OK and Save the formula. Now try to add one item to the list. If you put any other thing apart from “Mr” or “Mrs” in the Title column, it should display the message like below:
Similarly, If you want to validate another column, let’s say you have an age column and you want to show a validation message if the user put value less than 25.
You can write in the Column validation formula like below:
It should look like this:
Now when user try to put value less than 25, it will show a message like below:
Now we will see in another example, how to use SharePoint 2013 List validation settings. Here I have a SharePoint 2013 list which has two columns First Name and Last Name. My requirement here is if First Name and Last Name should not be the same, If the user enters the same value then it will display a validation message and data should not save to the list.
To use the List validation, Open your SharePoint 2013 list, then go to List Settings from the Ribbon. Then from the General Settings click on “Validation settings”.
Then in the Validation Settings page, In the formula box put:
And in the User Message box, you can put the message which you want to display to the user when validation fails. It should look like below:
Now when you try to add an item and if you put first name and last name same, then it will display a message like below:
This way you can validate that, first name and last name can not be same.
Similarly, Suppose you have a Date type column and you want user should always select a date less than today, then you can write the formula as:
Now if the user selects a date greater than today then it will display a message like below:
Similarly, if you want to validate the Title field length, then you can put the formula like below:
And you can display a message like below:
The title should not be more than 25 characters. After this if the user tries to put title length more than 25 characters then it will display the message like below:
You may like following SharePoint list and library tutorials:
- How to create a site column in SharePoint 2013/2016/Online
- Display Task List data in a table using SharePoint REST API and filter by status column
- How to create choice type site column and add mapping inside SharePoint hosted add-in in SharePoint 2013 Online?
- Create Collapsible tabs and All Columns tab using Infowise Ultimate Forms in SharePoint Online Office 365
- SharePoint 2013 Create Site Column and Content Types Using PowerShell
- Change Column Order in List Forms (new/edit/display) in SharePoint 2013/2016/Online without using Code
- Create a column in a list using Rest API in SharePoint Online Office 365
- How to add lookup column programmatically using csom in SharePoint online Office 365?
Hope this SharePoint tutorial helps to learn how to implement list column validation in SharePoint 2013/2016 or SharePoint Online.
I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SPGuides.com
Download SharePoint Online Tutorial PDF FREE!
Get update on Webinars, video tutorials, training courses etc.