Restrict What Users Can Enter Into Form Fields: Validation Strings

About

If your users are entering the word "five" instead of the number 5, or they accidentally enter a number incorrectly ($2011 instead of just $201), a feature called validation strings might help.



Setting Up Validation in NextStep Fields

Validation Strings have the following format:

validation||message
  • validation is the rule you are setting for the given field.
  • ||message is where you explain to users in a "Validation Failed" popup screen what the rule is.
    • Include the two || pipes, with no space between the pipes and the message.
    • This is optional. If you do not use a message, a default one will be displayed for you.

This table lists the various types of validation you can set for a field, and which field types allow each validation type.

Description
Validation
Popup Message
Form Field Types
Validation fails when the length of the value is greater than the specified maximum length.

For example, if the maximum size permitted is 25, set the Validation String to: maxlen=25

maxlen=x

OR

maxlength=x


Text

Memo


Validation fails when the length of the value is less than the specified minimum length.


minlen=x

OR

minlength=x



Text
Memo


Validation fails when the value contains any characters other than alphabetic or numeric characters.  


alnum 

OR

alphanumeric


Text
Validation fails when the value contains any characters other than alphabetic, numeric and space charactersalnum_s
OR
alphanumeric_space

Text

Validation fails when the value contains any characters other than alphabetic.

alpha
OR
alphabetic

Text


Validation fails when the value contains any characters other than alphabetic or space characters.


alpha_s 

OR

alphabetic_space 


Text


Validation fails when the value does not conform to the standard email address format (i.e. name@something.tld).


email

Text


The user-inputted value must be less than the value specified for x; it cannot be equal to or greater than that number.


For example, if the value should be less than 1000 give the Validation String as: lt=1000


lt=x

OR

lessthan=x


Integer
Double

Validates time

time

Text

Entry must be a number between 0-9999, and must be exactly 4 characters. 

regexp=^[0-9999]{4}$||Please enter the 4-digit code.
Text
Memo


Custom regex:

Validation fails when the value doesn’t match the specified regexp.  


For example, if you need to allow up to 20 alphabetic characters, specify the Validation String as: regexp=^[A-Za-z]{1,20}$


Note that regexp, or regular expressions, are complex validation rules, that are supported in the Validation String.

Learn more about RegEx/Regular Expressions.


Text
Memo
Integer
Double


Sample Validation String

Passing Value Examples

Failing Value Examples

Notes

maxlen=6

Brenda

John

Catherine

I am a long name that will fail


minlen=5

3-TNJ

2-TNJ-22

3TNJ

Amy


alnum

BP124

679Q

BP-124

679  Q


alnum_s

Frank has 2 children

679  Q

BP-124

This won’t pass


alpha

Frank

Fran

Frank2

Frank & Fran


alpha_s

Frank and Fran

Frank has two children

Frank2

Frank & Fran


Email

something@else.com

another@thing.net

something

something@else

something.else.com


lt=10

2

9

10

672


gt=99

100

999

99

2


regexp=^[0-9]{4}$||This field requires 4 digits only

1234

3456

123

12344

CCCC

Anything after the "||" is an error message.  So if the user does not enter 4 digits, they get the validation message "This field requires 4 digits only"

regexp=[a-z]+[0-9]+||This field requires lower case letters followed by numbers

abc123

a23

aaa5

abc

123

AbC43


regexp=[A-Z][A-Z*][A-Z][A-Z*]$||Onlyuppercase letters and * are valid. String must start with a leter. 4 characters required.

ABC*

RSLN

F*C*

ACB

ABCDE

*ACB

It has to be 4 characters.  Only upper case letters.  Second and forth character can be an *

regexp=^[0-9a-zA-Z]{8}$

A2345678

ABc4SD78

A23456789

ABC4SD78c


regexp=^[0-9][0-9]?[0-9]?$

1

23

567

c

1234


Up to 3 digits, and at least 1


Have you created a useful custom validation string? Please let us know and we will add it to our library!