Workflow Validator element
The goal of the Validator element is to ensure that the user provides necessary and properly formatted information needed to successfully complete an operation.
Validator can only be used in combination with other fields:
- Workflow Checkbox field
- Workflow Download field
- Workflow Input field
- Workflow Select field
- Workflow Suggestbox field
- Workflow TextArea field
- Workflow Upload field
Available validators:
| name | Description |
|---|---|
| req |
Required value. |
|
alpha |
Alphabetic value. |
|
alphanum |
Alphanumeric value. |
|
dec |
Decimal value. |
|
num |
Numeric value. |
|
|
Email address value. |
|
url |
URL value. |
|
maxlen |
Sets the maximum length allowed. |
|
minlen |
Sets the minimum length required. |
|
lt |
Less than a specified value. |
|
gt |
Greater than a specified value. |
|
min |
Minimum value. |
|
max |
Maximum value. |
|
regexp |
Regular expression. |
|
plugin |
Custom form validator implemented as a plugin. For more information, see: Creating your own Form Validator plugin. |
|
Parent: |
|
Basic example
- Value required "req".
- Value must be decimal "dec".
- The maximum length of the decimal value is 6 digits "maxlen".
<input label="Decimal value" name="decimal">
<validator type="dec"/>
<validator type="req"/>
<validator type="maxlen" parameter="6"/>
</input>
Regular expression
If you want a validation that is not included in these predefined ones, you can use a regular expression. For example, imagine you want to restrict an input to lowercase ASCII values:
<input label="Lowercase value" name="regExp">
<validator type="regexp" parameter="[a-z]+" />
</input>