Customizable Learner Field Validation Messages

Follow

This article only applies to portals that have upgraded to the New Learner Experience.

Within the New Learner Experience you’re able to customize the error messages that appear to users or learners on user fields and custom fields. These error messages will be used if you add custom regex to a field – which is helpful when you want to validate or restrict the information gathered from your learners.

Areas Used

The customizable validations have been added to the following pages. The same validation message will be displayed across all three pages based on the regex and translation term values provided.

  • Enrollment Key Sign Up Page
  • E-Commerce Sign Up and Shipping Address Pages
  • My Profile Page

Please note we currently support English, French, Spanish, German, Portuguese and Japanese languages with customizable field validations.

Configuring Validation Messages

Configuring a validation message is broken down in to different components:

  1. Adding a regex value to one of the user fields that is used to validate the field when a learner enters a value.
  2. Configuring the validation or error message that is displayed to the learner.

Adding a Regex (Regular Expression) Validation to a Field

A custom regex (validation) can be added by an Admin from the User Profile in Portal Settings for default user fields and Custom Fields in Portal Settings for user custom fields that have been defined.

The custom regex allows both plain text or a regex (regular expression). This allows you to have flexibility over the validations you want to apply to specific fields, either requiring a specific response or restricting a field to text only, numbers only, etc. For example, a custom regex could be added to the City field with either of the following:

  • Calgary – will only accept the text value “Calgary”
  • ^[a-zA-Z]+(\s[a-zA-Z]+)?$ – will accept any text as long as it’s letters in the alphabet and can have spaces

The added validation will be used based on the options set on the field as well. If the field is hidden or read only, the validation will not be used. If the field is required, once the user adds a value to the field the validation will be checked. If the field is optional, only when/if the user adds a value will the validation be checked.

There are fields that require special attention.

  • Country (drop-down)
    • Adding a regex to the Country field (to limit where your users can come from or the address entered), you should use the country code (e.g. CA for Canada) – note the case used. A full list of codes can be found in the appendix at the bottom of this article.
  • Province/State (drop-down)
    • Adding a custom regex to the Province/State field should include the full spelled out version of the Province or State in order to match a value in the Province/State drop-down presented to the user. E.g for California use “California”, for British Columbia use “British Columbia”, etc. – note the case used.
  • Language (drop-down)
    • Adding a custom regex to the Language field should use the language code (e.g. en for English) – note the case used. A full list can be found in the appendix at the end of this article.
  • Text-based Custom Field (text or drop-down)
    • A list can be created for a text-based custom field. A regex for this field can be added where the regex value (text) must match a given list value.
    • A text-based custom field can also allow user entry and the custom regex can either be a word (e.g. “Red”) or a regex (e.g. for a UK cell phone number).

Adding a Validation Message Term Value

The field validations have been split in to two separate terms, one for the generic message that is displayed in all error cases and a second field-specific term to provide the error details for that field.

The format for the field validations is FieldValidationMessage followed by FieldNameValidationDetails.

FieldValidationMessage

  • The default English value for this is “{0} does not meet minimum requirements:” where {0} is the field name in question that is incorrect.
  • You have the option to update or customize this to fit your specific needs based on your permissions to the LMS Admin site from the Settings menu item. If you want to continue to include the field name that is in error, please include {0} somewhere within the value.

FieldNameValidationDetails

  • Separate terms have been created for each of the available user profile fields and text-based custom fields that can accept a regex field validation. For example, FirstNameValidationDetails, LastNameValidationDetails, PhoneNumberValidationDetails, CustomField1ValidationDetails, etc.
  • The value for each of these terms has been purposely left blank. This allows you to add your own validation message to these terms if/when a regex is entered.
  • The translation values can allow special characters.
  • A full list of fields that allow customized validation messages is included in the appendix at the end of this article.

Example Validation – Phone Number

A regex for phone number could be: ((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}. This ensures that a dash exists and or brackets around the area code in the phone number.

The PhoneNumberValidationDetails term value could then be: “###-###-####' or (###) ###-####.”

If a phone number of 4035551234 is entered, then the following message would be displayed: “Phone Number does not meet minimum requirements: ###-###-#### or (###) ###-####.”

The validation message will be displayed below the field in question.

Appendix

Fields with Custom Validation Messages

  • The following fields allow custom validation messages:
    • Default User Fields
      • Address2ValidationDetails
      • AddressValidationDetails
      • CityValidationDetails
      • CountryValidationDetails
      • EmailAddressValidationDetails
      • EmployeeNumberValidationDetails
      • FirstNameValidationDetails
      • JobTitleValidationDetails
      • LanguageValidationDetails
      • LastNameValidationDetails
      • LocationValidationDetails
      • MiddleNameValidationDetails
      • PasswordValidationDetails
      • PhoneValidationDetails
      • PostalCodeValidationDetails
      • ProvinceValidationDetails
      • UsernameValidationDetails
      • VerifyPasswordValidationDetails
    • Custom Fields
      • CustomFieldString1
      • CustomFieldString2
      • CustomFieldString3
      • CustomFieldString4
      • CustomFieldString5
      • CustomFieldString6
      • CustomFieldString7
      • CustomFieldString8
      • CustomFieldString9
      • CustomFieldString10
      • CustomFieldString11
      • CustomFieldString12
      • CustomFieldString13
      • CustomFieldString14
      • CustomFieldString15
      • CustomFieldString16
      • CustomFieldString17
      • CustomFieldString18
      • CustomFieldString19
      • CustomFieldString20
      • CustomFieldString21
      • CustomFieldString22
      • CustomFieldString23
      • CustomFieldString24
      • CustomFieldString25
      • CustomFieldString26
      • CustomFieldString27
      • CustomFieldString28
      • CustomFieldString29
      • CustomFieldString30

Country Codes

Language Codes

  • The following language code should be used when adding a custom regex validation to the Language field (case sensitive):
    • English – en
    • French – fr
    • Spanish – es
    • Japanese – ja
    • Arabic – ar
    • Chinese (Traditional) – zh-Hant
    • Chinese (Simplified) – zh
    • Italian – it
    • German – de
    • Dutch – nl
    • Polish – pl
    • Portuguese – pt
    • Russian – ru
    • Turkish – tr
    • Thai – th
    • Korean – ko
    • Vietnamese – vi
    • Mongolian – mn
    • Swedish – sv
    • Czech – cs
    • Finnish – fi
    • Hebrew – he
    • Greek – el
    • Danish – da
    • Norwegian – no
    • Hungarian – hu
    • Romanian – ro
    • Slovak – sk
    • Bahasa Melayu – ms
    • Hindi – hi
Published on
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.