Create Custom Validation Patterns For Controls In Item View Using K2 Designer In SharePoint 2013 Online

Item Views work with a single record of a SmartObject and are bound to the scalar methods of the SmartObject. Item Views can be used to display data (read-only) or capture data for either a new record or editing an existing record. Views are used to design a Form. Please refer my previous article to create Item View using K2 Designer.

Validation Patterns are regular expressions used to enforce validation on a certain control when data is captured. There are several default validation types available. Additional validation patterns can be configured and the validation error message can be customized. Please refer my previous article to apply validation patterns.

I have a custom list named “K2 Workflow Tutorials” in which I have created an Item View. We will see how to create custom validation pattern using K2 Designer.

Navigate to the custom list. Click on List tab and then click on Application button under K2 section in the ribbon interface. Click New and then click on View.

In the category tree, expand K2 Designer, All Items, SharePoint 2013, <SiteName> => Lists=> K2 Workflow Tutorials, then My Sample Item View.

Click on Edit. A pop up displays to check out the view. Please click on Yes button to check out the view.

I have a text field named “Text Column” for which I am going to create a custom validation pattern.

Select the control, in the properties tab expand Validation. Click on ellipsis next to pattern. Click on Add Pattern.

validation pattern

Enter the new validation pattern and then click on Ok button.

Add new validatin pattern

Select the custom validation pattern that we have created and then click on Ok button. Click on Finish button.

Add pattern

Click on Check In to check in the view changes and then click on Run. If you enter a character which is not CAPS, then you will get the following error message.

Sample Item View