Sunday, December 9, 2012

How to validate the special character on SharePoint List Column

Step 1: Open Column Settings for which column you want to add the validations:

List Settings > Change Column > Column Validation (below Column Settings) 

Step 2: Add the following code at the Column Validation:

=AND(IF(ISERROR(FIND(",",[ColumnName])),TRUE),IF(ISERROR(FIND("&",[ColumnName])),TRUE),IF(ISERROR(FIND("!",[ColumnName])),TRUE),IF(ISERROR(FIND("@",[ColumnName])),TRUE),IF(ISERROR(FIND("~",[ColumnName])),TRUE),IF(ISERROR(FIND("#",[ColumnName])),TRUE),IF(ISERROR(FIND("$",[ColumnName])),TRUE),IF(ISERROR(FIND("%",[ColumnName])),TRUE),IF(ISERROR(FIND("*",[ColumnName])),TRUE),IF(ISERROR(FIND("(",[ColumnName])),TRUE),IF(ISERROR(FIND(")",[ColumnName])),TRUE),IF(ISERROR(FIND("-",[ColumnName])),TRUE),IF(ISERROR(FIND("+",[ColumnName])),TRUE),IF(ISERROR(FIND(":",[ColumnName])),TRUE),IF(ISERROR(FIND(";",[ColumnName])),TRUE),IF(ISERROR(FIND("[",[ColumnName])),TRUE),IF(ISERROR(FIND("]",[ColumnName])),TRUE),IF(ISERROR(FIND(".",[ColumnName])),TRUE),IF(ISERROR(FIND("/",[ColumnName])),TRUE),IF(ISERROR(FIND("\",[ColumnName])),TRUE))

4 comments:

  1. It's enjoyable to learn more and more from your blog. Thanks for sharing.

    www.gofastek.com

    ReplyDelete
  2. Hi, any idea why this doesn't work for question marks?
    Thanks

    ReplyDelete
  3. or in fact full stops. It doesn't kick up a validation error and instead goes straight to the error creating the list entry.

    ReplyDelete
  4. Thank you so much for this post. Special characters interfere with workflows and this looks like a viable solution.

    ReplyDelete