Page History
...
Simple validator definition:
Localtab Group | ||||||||
---|---|---|---|---|---|---|---|---|
Localtab | ||||||||
| ||||||||
Code Block | ||||||||
| ||||||||
form:
tabs:
- name: tabUser
label: User info
fields:
- name: emailAddress
fieldType: text
label: Email
validators:
- name: email
class: info.magnolia.ui.form.validator.definition.EmailValidatorDefinition
errorMessage: Enter a valid email address Localtab | | JCR node | ||||||
Advanced Tables - Table Plus | ||||||||
| ||||||||
Node name | Value |
|
|
|
|
|
|
|
| info.magnolia.ui.form.validator.definition.EmailValidatorDefinition | |||||||
| Enter a valid email address | |||||||
| text | |||||||
|
Properties:
<field name> | Name of field. | ||||||
| required Contains the validator definition. | ||||||
| required Arbitrary node name. Use a name that describes the validator type. | ||||||
| required Validator definition class. Use the fully-qualified class name. | ||||||
| optional Fully qualified name of the Java class that creates the validator. The class must implement
| ||||||
| optional Text displayed to the user on invalid input. Text string or message bundle key. | ||||||
| optional Message bundle for localized messages. This property can be set at dialog, form, tab or field level. | ||||||
| required for regex validation Regular expression pattern when using the |
...
Here is an example of validating a ZIP code (U.S. postal code).
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
form:
tabs:
- name: tabUser
label: User info
fields:
- name: zipCode
fieldType: text
label: Zip code
validators:
- name: zip
class: info.magnolia.ui.form.validator.definition.RegexpValidatorDefinition
pattern: ^\d{5}(-\d{4})?$
errorMessage: Enter a valid U.S. ZIP code using the format 12345 or 12345-1234 Localtab | | |||||||
| ||||||||
Localtab | ||||||||
| ||||||||
Advanced Tables - Table Plus | ||||||||
| ||||||||
Node name | Value |
|
|
|
|
|
|
|
| info.magnolia.ui.form.validator.definition.RegexpValidatorDefinition | |||||||
| Enter a valid U.S. ZIP code using the format 12345 or 12345-1234 | |||||||
| ^\d{5}(-\d{4})?$ | |||||||
| text |
| Zip code
Custom validators
To write your own validator class:
...