Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
minLevel2
maxLevel2
outlinefalse
typelist
printablefalse

Types of validation rules

Required: Requires the user to input a value. If selected you will be prompted to add an optional Required message that will display if the element is empty.

...

But, if we want to only match UWaterloo email addresses, we need to improve the regex. To do this we need to know about special characters.

Special characters

  • A period ‘.’ matches any character.

  • To literally match a period used in a string of text, we need to add a backslash ‘\’ before the period.

...

  • ‘[0-9]’ matches any digit from 0-9.

  • ‘{3}’ means that the previous thing must appear exactly 3 times. 

  • ‘^’ (caret) matches the beginning of the text. It is the opposite of ‘$’ (which matches the end of the text).

  • This regular expression matches a telephone number (within the North American numbering plan).

Adding a Regular expression to a Web form

  1. From the administration bar, select Workbench, and then select the My Dashboard.

  2. Navigate to the Forms list.

  3. Locate the form you want to configure and select Build from the Operations column.

    Screenshot of Forms list
  4. Select Edit under the Operations column next to the element you would like to add a Regular expression to. Alternatively, select Add element to create a new element. The Pattern validation rule is not applicable to every element type.

  5. In the Edit element window, navigate to the Form Validation panel, and select Pattern.

  6. Enter the Regular expression in the Pattern regular expression field.

  7. Enter a custom error message in the Pattern message field.

    1. Note: Complex validation rules require a custom error message that will be displayed if user-entered information doesn’t pass validation.

      Image RemovedImage Added

  8. Select Save.

Additional resources for regular expressions

...