Continuing our series on Bamboo Custom Columns, today we'll discuss the Bamboo Validator Column. The Bamboo Validator Column enables you to create programmatic restrictions on values entered into a list column, so that data is automatically validated before being stored, and invalid data can be immediately corrected by users.
To begin, we need to create a new Bamboo Validator column. To create a new column, select the Create Column action located under the Lists Ribbon:
Then select the column type, Bamboo Validator:
The Bamboo Validator Column provides a wealth of options, allowing the column to tailor to the specific needs of the customer. First we need to define what type of data will be input by the user. You can select from:
- Single line of text
- Date and Time
Depending on the Column Data Type selected, you will be presented with additional options to define the display format, similar to a standard SharePoint column type.
Single Line of Text
No additional options.
Define the number of decimal places to use. Also define if the value is a percent or a number:
Similar to number, define the number of decimal places. In addition, define the currency format:
Date and Time
Select if the value is Date Only or Date and Time. You can also define a default value for the column if desired:
Now that we have selected the appropriate data type, we'll move onto the other options.
Input Required: When you check this option, if a user doesn't input data, there will be an error message asking them to enter data based on the message you provide:
So if a user creates or modifies an item and fails to enter a value, when they attempt to save the field, they will see the message you defined:
Pattern Comparison: This setting validates if the value entered by the user matches a predetermined format that you have selected in the settings. First you choose if you want to use a "predefined pattern" or a "regular expression." If you selected "predefined format," you can select from a range of expected format options as shown below:
If none of these options meet what you are looking for, you can instead select "Please enter regular expression" and define your own. If you choose to build your own, you have a wide selection of options available, as described in the MSDN articl Introduction to Regular Expressions (Scripting). After you have defined your appropriate settings, enter a message to be displayed if the user's entered value does not match the expected format.
Range Comparison: If the Column Data Type is Number, Currency, or Date and Time, you can make sure the data the user enters are within an expected range.
Column and Value Comparison: This setting allows you to compare the value the user entered to another fixed value (for example, if the column is expecting a number, you can verify that the number the user enters is greater than 5). You can also compare a value the user enters to another column value as well. If the value the user enters does not meet the expected value, define the message that will be displayed to the user:
The final setting is the Tool Tip Text. This is the text that is displayed when the user hovers over the field in the New or Edit forms. Very useful for providing a description or tips for the column:
Read our entire series dedicated to Bamboo Custom Columns:
Oct 25 2012, 01:30 PM
Tuan Van Huynh