Simple Column Validation in Sharepoint 2010



  • In Sharepoint 2010 we can easily validate the column values entered into list items.

    We have two levels of validation:

    1. Column level
    2. List level
    Both of them use Sharepoint Formulas. Here you can find a complete list of formulas and functions

    and the description of each of them:

    http://officebeta.microsoft.com/en-us/sharepoint-foundation-help/CH010372694.aspx

    I will show two simple examples of how to use column validation, at column level and at list level.

    Example 1 : Column Level Validation.

    1. Create a new column on a list, click 'column validation':

    2. Into the 'Formula' text area add a validation Formula. For example, I'll add a very simple E-mail format validation:

      Note that into 'User message' text area you can enter the message you want the user see when the validation is not passed.

    Example 2 : List Level Validation.

    1. In the List Settings, click on 'Validation Settings'.

    1. Into the 'Formula' text area add a validation Formula. For example, this formula check that Value3 is the biggest and Value2 is bigger than Value1*.

    About Conflicts:

    We have to take into account that Sharepoint evaluate firstly the 'Column Level' Formulas and then the 'List Formulas'.

    So, what if List and Column level validations are in conflict?.

        For example:

            •On the one hand we have the following List level Validation:

                [Column1]>[Column2]

            

            •On the other hand we have the following Column level Validation:

                [Column1]=100

                [Column2]=200

    As a result of the conflict, in this case, it will impossible to submit a list item.

    References:

    http://officebeta.microsoft.com/en-us/sharepoint-foundation-help/CH010372694.aspx

    http://blogs.pointbridge.com/Blogs/2010wave/Pages/Post.aspx?_ID=5



  • Comments



Add a Comment