Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

Validators can be applied to individual form fields on your pages to help ensure your supporters supply responses that conform to your data requirements.

The error alert specified in the validator will be displayed automatically if the supporter enters a value that doesn’t match the validator and then submits the page.

Types of validators

Engaging Networks has eleven default validators available plus one custom that you can create:

Type

Description

Required

Use on mandatory form fields and if left blank, it will display your message.

Alphanumeric

You can request that the data entered is letters and numbers only.

Required Alphanumeric

You can request that the data entered is letters and numbers only that is mandatory.

Restricted Alphanumeric (25 characters)

Does not allow the characters

@/\.:

to be submitted in a field. It also restricts to a maximum of 25 characters. This is useful if you are finding you are receiving spam URL-type submissions into the First Name and Last Name

Numeric

You can request that the data entered is numbers only.

Required Numeric

You can request that the data entered is numbers only that is mandatory.

Date

You can request that a value entered in a date field is in a specific date format. You can choose one of the following formats:

  • mm/dd/yy

  • mm/dd/yyyy

  • dd/mm/yy

  • dd/mm/yyyy

  • dd/mm

  • mm/yy

  • mm/yyyy

NOTE: The tagged field “SUPPORTER BIRTHDAY” has to be formatted as YYYY-MM-DD and should not use this validator.

Required Date

You can request that a value entered in a date field is in a specific date format that is mandatory.

Email

You can validate if the value entered in the email address field is a valid email format.

Required phone number

The field should include the “+” country code at the start, for example +44123456789. This format is required for click to call pages and for SMS.

Custom

You can create a tailored validator using regular expressions (regex) such as:

  • ^(\d{5}-\d{4})|(\d{5})$ – validates that 5 numbers are entered or 5 numbers, a dash and 4 numbers (ie. zip code validator)

  • (blue|orange|red) – validates that either blue or orange or red is inputted

  • More examples below and at this link. 

Donation Amount

You can set a minimum and maximum donation amount allowed on the form. Enter the min~max (5~1000) separated by a ~ symbol. If a decimal is included in the value range, it will also be allowed in the field (5.01~1000.99)

ISO Date

You can validate that the date entered is in the ISO (international) date format YYYY-MM-DD.

NOTE: Each validator will have an error alert for each locale enabled in your account.

Creating validators

To create a new validator, go to Pages > Alerts & Validators

Click on the new validator buttonvalidator.png and select the validator type.

Enter a name for your validator as well as the error message the supporter will receive if the validator is triggered.

Managing Validators

To edit an existing validator, click on the edit icon.

To delete an existing validator, click on the delete icon.

Custom Validators

Some examples below and at Github

Type

Expression

Account number (8 digits)

^\d{8}$

Credit card number (16 digits)

^\d{16}$

CVV number (3 or 4 digits)

^\d{3,4}$

First name longer than 1 character

^.{2,}$

Sort code (6 digits no hyphens)

^\d{6}$

UK postcode

^$|([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z]))))\s?[0-9][A-Za-z]{2})

Republic of Ireland postcode

((?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}$)|(^$|([Gg][Ii][Rr] 0[Aa]{2}))

  • No labels