Introduction
Hope my series of SharePoint validation articles helps everyone to resolve their issues right from basics to advanced.
You can check my other series of posts
You can check my other series of posts
How to implement validations in Detail http://adicodes.com/column-validations-and-list-validations-in-sharepoint-2010/
How to implement Date Validation based on a scenario
http://adicodes.com/date-validation-in-sharepoint/
http://adicodes.com/date-validation-in-sharepoint/
In this post we will cover the below scenario. This scenario is one of the basics to understand more complex validations further
Scenario – First letter of the user input should be capital letter
I am using the following List Column and type in the example
FirstName – Single line of text
FirstName – Single line of text
Formula and validation message setting
This is column level validation as formula involves with itself not with another column. So, validation rule should be provided at
List Settings > select column FirstName under columns > Add formula under Column Validation
(FirstName is the column we are implementing according to our scenario)
Validation Message
Formula
=CODE(UPPER(MID(FirstName,1,1)))=CODE(MID(FirstName,1,1))
MID(FirstName,1,1) – this gets the first letter from the user input. In our case, according to the above input (adiseshu), it gets ‘a’.
UPPER(MID(FirstName,1,1)) – converts ‘a’ to ‘A’
CODE(UPPER(MID(FirstName,1,1))) – get the ASCII of ‘A’
This ASCII code should be equal to the value given by the user. If they are not equal, it is an invalid input.
You can refer list of ASCII codes here http://www.asciitable.com/
You can refer list of ASCII codes here http://www.asciitable.com/
No comments:
Post a Comment