You can use the Field Validation feature to ensure that Evidence.com users enter information in the agency-defined format for specific fields. The feature lets administrators use a regular expression (regex) entry to set the expected format for the field and enter descriptor text to provide format information to users. When field validation is enabled, the descriptor text appears as hint text in the appropriate Evidence.com field and as part of the error message if the user does not enter the correct format.
When Evidence ID field validation is enabled, it is also enforced when entering Evidence ID information in Axon View and Axon Capture with some limitations.
- Axon View – The body worn camera that is paired with the application must have connected to Evidence.com (through an Axon Dock or Evidence Sync) after the last Evidence ID field validation change was made.
- Axon Capture – The application must connect to Evidence.com and receive updates after the last Evidence ID field validation change was made.
Currently, you can enable field validation requirements for user Badge ID and Evidence ID. By default, both of these settings are not enabled.
Configure Field Validation
Administrators and users with roles that have the Edit Agency Settings permission set to Allowed can configure field validation.
Whether you are enabling a field validation for the first time or just updating the regular expression, the steps for configuring field validation are the same.
- On the menu bar, click Admin and then click Fields Validation.
The Field Validation page is shown. - Select the Badge ID, Evidence ID, and/or Case ID toggle switch to enable field validation.
- For each field validation that is enabled:
- In the Regex box, enter the regular expression that you want to use for field validation.
See Regular Expressions for Field Validation for information and examples of regular expression notations. - In the Descriptor box, enter the text that you want to appear as hint text in the field.
See User Experience for an example of how the Descriptor text is used. - Click Save.
- In the Regex box, enter the regular expression that you want to use for field validation.
Disable Evidence ID Validation
Administrators and users who are allowed both the Category Administration and the Edit Agency Settings permissions can disable evidence ID validation as needed.
- On the menu bar, click Admin and then click Field Validation.
- Find the field validation you want to disable, Badge ID, Evidence ID, and/or Case ID, and select the toggle switch to disable field validation.
- For each field validation that is disabled, click Save.
Regular Expressions for Field Validation
Using standard Javascript regular expression notation, you can describe your agency’s evidence ID format requirements. In order for an evidence ID to be valid, the ID must match the regular expression that you define.
The regular expression you specify must have a specific format.
- It must start with the following two characters: /^
- If you need ID validation to be case sensitive, the regular expression must end with the following two characters: $/
- If you need ID validation to be case insensitive, the regular expression must end with the following three characters: $/i
- Between the starting and ending characters, you provide a search pattern.
/^search-pattern$/
/^search-pattern$/i
The valid syntax for regular-expression search patterns is extensive and allows for great flexibility; however, if you are not already familiar with regular expressions, it is strongly recommended that you study Javascript regular expressions prior to implementing evidence ID validation in your Evidence.com agency.
For more information about Javascript regular expressions, see the following sites:
- Regular Expressions User Guide
- Debuggex, a regular expression debugger site
Example Regular Expressions
The following table provides a few examples of ID formats and regular expressions that match only IDs that comply with the ID format.
ID Format Example & Description | Matching Regular Expressions and Comments |
YYYYMMDDnnnnnn Four-digit year, two-digit month, two-digit day, and 6-digit number. |
The following regular expression matches the YYYYMMDDnnnnnn format and requires that the ID begin with 20; however, it does not account for months with less than 31 days. /^20\d\d(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])[0-9]{6}$/ |
YYYY-nnnnnn |
The following regular expression allows any year between 2000 and 2099, with or without 20 at the start of the ID. /^(20)?(\d\d)-[0-9]{6}$/ The following regular expression requires that the ID begin with 2015; however, at the start of the new year, you would need to modify the regular expression. /^(20)?(15)-[0-9]{6}$/ |
XX-XXXX Two characters, a dash, and then four characters. |
The following regular expression allows any two alphanumeric characters, a dash, and then any four alphanumeric characters. /^[\w]{2}-[\w]{4}$/ |
User Experience
When adding or updating IDs, users see hint text that reflects the field format requirements. For example, a user changing evidence IDs on an evidence search page sees the following dialog box:
If a user enters an evidence ID that does not match the regular expression configured for ID validation, Evidence.com does not allow the user to assign the ID to the evidence. In the error message that appears, Evidence.com indicates that the ID is not valid and provides the hint text again.