SharePoint has List level and Column level validation to ensure that the right kind of data is inserted into the list. With these kinds of validations we get to do data check out of the box. Validation settings remain unchanged as of SharePoint 2016 as well as in SharePoint online.

There are certain rules that govern list level validations which, if not followed will result in errors.

If both Column level and List level validations are present, Column validations are checked first followed by List validations. If column and list validations are in conflict data is never saved to the list. Before checking out how we can implement List validations using JSOM let’s see how we can do it out of the box.

List validations can be accessed from List settings->Validation Settings.



The formula is the expression that would check for the entered data for correctness. If the data does not match the expression we will get the message specified in the user message column.

Let’s see how we can implement this using JavaScript object model.

Output



Let’s see how we can implement this in SharePoint.

Thus we have seen how to add validation settings to a list using JavaScript object model.