Data field validators

BriteLines provides field validators that you can define when creating a field. Field validators ensure that data entered while creating a quote matches the expected pattern.

Number field

Number type data fields can be set up to use the following validators:

  • Number Range validator
  • Decimal Places validator

Number Range field validator

The Number Range validator allows a user to set minimum and maximum values. Based on these values, the validator will determine if the provided number is in the range.

Error messages

While quoting, if a user enters a value that doesn’t match the specified range, then one of the following errors will be displayed:

  • Number must be between {minimum} and {maximum}. If the value is less than the specified minimum value or greater than the maximum value specified in the field validator.
  • {field_value} is below the minimum of {min_value}. If the field validator has only a minimum value set (maximum is blank) and the value is less than the specified minimum value.
  • {field_value} is above the maximum of {max_value}. If the field validator has only a maximum value set (minimum is blank) and the value is greater than the specified maximum value.

Number range examples

Field: Mileage

Minimum and maximum example:

  • Specified minimum: 10
  • Specified maximum: 40
  • Valid values:
    • 10
    • Any value between 10 and 40
    • 40
  • Invalid values:
    • Any value below 10
    • Any value greater than 40

Maximum example:

  • Specified maximum: 10000
  • Valid values:
    • 10000
    • Any value below 10000
  • Invalid values:
    • Any value greater than 10000

Minimum example:

  • Specified minimum: 500
  • Valid values:
    • 500
    • Any value greater than 500
  • Invalid values:
    • Any value below 500

Decimal Places field validator

The Decimal Places validator allows a user to set a maximum decimal place value.

Error messages

While quoting, if a user enters a value that has more decimal places than the maximum decimal places specified, the following error will be displayed: Cannot have more than {Maximum Decimal Places} decimal places.

Decimal places examples

Field: Mileage

Maximum decimal example:

  • Specified maximum decimal places: 0
  • Valid values:
    • 10
    • 20
  • Invalid values:
    • 10.1
    • 20.22

Maximum decimal example:

  • Specified maximum decimal places: 2
  • Valid values:
    • 20
    • 20.2
    • 20.22
  • Invalid values:
    • 20.222
    • 20.2222

Date field

Date type data fields can be set up to use the Date Range validator.

Relative Date Range field validator

The Relative Date Range validator allows a user to configure the Earliest Allowed Date and Last Allowed Date settings in years, months, or days.

Error messages

While quoting, if a user enters a value that doesn’t match the specified range, then one of the following errors will be displayed:

  • Date must be between {Earliest Allowed Date} and {Last Allowed Date}. If a user enters a date in a field that is less than the specified earliest allowed date or greater than the specified last allowed date.
  • {field_value} is before the minimum date of {Earliest Allowed Date}. If the field has only a minimum range set (maximum is blank) and a user enters a value that is less than the specified minimum value.
  • {field_value} is after the maximum date of {Last Allowed Date}. If the field has only a maximum range set (minimum is blank) and a user enters a value that is greater than the specified maximum value.

Relative date range examples

Years example:

If you created a Birthday field on the Years tab with the settings below, a user would be able to select a date between 2019-05-23 and 2026-05-23.

  • Earliest Allowed Date: -2
  • Last Allowed Date: 5
  • Rating Date: 2021-05-23

Months example:

If you created a Birthday field on the Months tab with the settings below, a user would be able to select a date between 2021-03-23 and 2021-10-23.

  • Earliest Allowed Date: -2
  • Last Allowed Date: 5
  • Rating Date: 2021-05-23

Days example:

If you created a Birthday field on the Days tab with the settings below, a user would be able to select a date between 2021-05-21 and 2021-05-28.

  • Earliest Allowed Date: -2
  • Last Allowed Date: 5
  • Rating Date: 2021-05-23

String field

String type data fields can be set up to use the following validators:

  • Length Range field validator
  • Regular Expression field validator

Length Range field validator

Length Range validator allows a user to set a minimum and a maximum number of characters that a value can have.

Error messages

While quoting, if a user inputs a value that doesn’t match the specified range, then one of the following errors will be displayed:

  • Length must be between {minimum} and {maximum}. If a user enters a length value in a field that is less than the specified minimum value or greater than the specified maximum value.
  • Value must be exactly {minimum} characters length. If the field’s minimum and maximum length values are the same and a user enters a length value that is less than or greater than the validation value.
  • {field_value} has length below the minimum of {min_value}. If the field has only a minimum limit set (maximum is blank) and a user value’s length for a field is less than the specified minimum.
  • {field_value} has length above the maximum of {max_value}. If the field has only a maximum limit set (minimum is blank) and a user value’s length for a field is greater than the specified maximum.

Length range validation example

  • Field: Fullname
  • Specified minimum: 5
  • Specified maximum: 10
  • Valid value:
    • Robert
  • Invalid values:
    • Robert Hart

      Note: The 11 characters (including the empty space) exceed the specified maximum value.

    • Hart

      Note: The four characters don’t meet the specified minimum value.

Regular Expression Field Validator

The Regular Expression validator allows a user to set a regular expression (sequence of symbols and characters used to represent a pattern) to be validated against.

For more information on regular expressions, use the following resources:

Error messages

While quoting, if a user inputs a value that doesn’t match the specified regular expression, the following error will be displayed: Format is unsupported.

Regular expression validation examples

Email example:

  • Regular expression value: ^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$
  • Valid values:
    • robert@britecore.come
    • ro@br.co
  • Invalid values:
    • robert
    • robert@
    • robert.com

Phone number example:

  • Regular expression value: ^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$

    Note: This value is for the Regex field.

  • Valid values:
    • (123) 456 7890
    • 123-456-7890
  • Invalid values:
    • 12 45 78
    • 123 456 78
    • (123) 456 78