locked
Column validation does not work RRS feed

  • Question

  • Hello,

    I have a custom list, and I want to add column validation on the Title field (single line of text, required field).
    To keep things simple here, let's assume that I don't want users to use the character "a" in the title.

    I go to List settings, I click on the Title column.
    In the column settings, I go to "Column Validation"
    I enter the formula:
    =IF(ISERROR(FIND("a",Title)),True)
    And I enter an error message and save the settings.

    If I try to add a new item in the list and eg provide title "a test item", then I don't see the error message.
    What am I doing wrong here?
    Thursday, September 13, 2012 1:22 PM

Answers

  • OK guys, figured it out.

    It seems like another bug in SharePoint this one....

    In my custom list I had other required fields.
    While testing my column validation, I only filled out the Title field.
    That way I was sure that the item wouldn't be saved (because I didn't fill out the other required fields).

    Seems that SharePoint will give priority on the validation of required fields.
    So it will throw errors on any required field that isn't filled out, and it won't proceed to do column validation.
    When I fill out all required fields as well, then SharePoint does display the column validation error.

    Way to go SharePoint!

    Thanks everyone for trying to help me out!

    • Marked as answer by kurtvd Friday, September 14, 2012 6:56 AM
    Friday, September 14, 2012 6:56 AM

All replies

  • Hi

    try this

    ISNUMBER(FIND("a",[Title])),


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.


    Thursday, September 13, 2012 1:33 PM
  • No luck, I changed it to this:
    =IF(ISNUMBER(FIND("a",[Title])),True) 

    Then SharePoint automatically changes this to:
    =IF(ISNUMBER(FIND("a",Title)),True) 

    So without []
    And still same result, if I type "a test item" it still doesn't give me an error.

    Thursday, September 13, 2012 2:44 PM
  • Hi,

    Pls Refer this thread

    http://sharepointsolutions.com/sharepoint-help/blog/2011/12/how-to-validate-an-email-address-using-column-validation-in-sharepoint-2010/

    This shows how to validate email address (by checking for '@' and '.')

    U may make use of it for validating ur characters.

    Friday, September 14, 2012 4:26 AM
  • Hi Kurtvd,

    please see the below example.

    =IF(ISNUMBER(FIND("a",[Title])), "Not OK", "OK")

    EXAMPLE

    =ISNUMBER(FIND("BD",[Column1]))

    DESCRIPTION

    The FIND function searches for the string BD in Column1 and returns the starting position of the string. It returns an error value if the string is not found.
    The ISNUMBER function returns Yes if the FIND function returned a numeric value. Else, it returns No.

    http://moss2036/_layouts/help.aspx?Lcid=1033&Key=WSSEndUser_FormulaSyntaxError&ShowNav=true

    Friday, September 14, 2012 6:05 AM
  • OK guys, figured it out.

    It seems like another bug in SharePoint this one....

    In my custom list I had other required fields.
    While testing my column validation, I only filled out the Title field.
    That way I was sure that the item wouldn't be saved (because I didn't fill out the other required fields).

    Seems that SharePoint will give priority on the validation of required fields.
    So it will throw errors on any required field that isn't filled out, and it won't proceed to do column validation.
    When I fill out all required fields as well, then SharePoint does display the column validation error.

    Way to go SharePoint!

    Thanks everyone for trying to help me out!

    • Marked as answer by kurtvd Friday, September 14, 2012 6:56 AM
    Friday, September 14, 2012 6:56 AM
  • Thank you very much!

    Just the answer I needed. Greetings from Colombia.


    Wednesday, June 20, 2018 9:51 PM