Metadata Validator element
The goal of the Validatior element is to ensure that the user provides necessary and properly formatted information needed to successfully complete an operation.
The validator can only be used in combination with other fields:
- Metadata Checkbox field
- Metadata Input field
- Metadata Select field
- Metadata Suggestbox field
- Metadata TextArea field
Available validators:
name | Description |
---|---|
req |
Required value. |
alpha |
Alphanumeric value. |
dec |
Decimal value. |
num |
Numeric value. |
|
E-mail value. |
url |
URL value. |
maxlen |
Set the maximum length allowed. |
minlen |
Set the minimum length required. |
lt |
Less than. |
gt |
Greater than. |
min |
Minimum value. |
max |
Maximum value. |
regexp |
Regular expression. |
Parent: |
Basic example
- Value required "req".
- Value must be decimal "dec".
- The maximum lenght of the decimal value is 6 digits "maxlen".
<input label="Decimal value" name="okp:consulting.decimal">
<validator type="dec" />
<validator type="req" />
<validator type="maxlen" parameter="6" />
</input>
Regular expression
If you want a validation which is not included in these prefefined, you can use a regular expression. For example, imagine you want to restrict an input to lowecase ASCII values:
<input label="Lowercase value" name="regExp">
<validator type="regexp" parameter="[a-z]+" />
</input>