views:

22

answers:

1

How do I validate special column types, e.g. phone, e-mail etc in SharePoint 2010?

I guess I could use an ASP.NET RegularExpressionValidator but surely there must be a simpler way?

+1  A: 

There isn't really an easier way. If you want to compare values of one column to another or if you want very basic validation you can use Column Validation, but it doesn't support regular expressions so it won't help with things like email.

You could use jQuery to do the validation, which is a bit easier than using a validator, although it only checks on the client side.

Another option if you have the Enterprise version of SharePoint is to use InfoPath to edit the list. With InfoPath you can easily add regex validation.

Estyn
Thanks for the suggestions. Quite baffling that SP doesn't offer regex validation out of the box. Came across this post that suggests you can use LIKE with a pattern match to validate an e-mail, e.g. [E-mail] LIKE "*?@?*.?*", but when I submit this in the Column Validation box I get an exception!http://blogs.pointbridge.com/Blogs/2010wave/Pages/Post.aspx?_ID=5
Robert Morgan
I don't think you can use "like", I believe the allowed values are the same values that you can use for calculated values.https://office.microsoft.com/en-us/windows-sharepoint-services-help/CH001171117.aspx?stt=1That being said, we can do an approximation of email validation with something like this:=AND(FIND("@",email,1)>0,FIND(".",email,1)>0)
Estyn