This page demonstrates how to use an array of structs to provide server-side
validation errors to the form. View the
code used to generate the form.
Choices, Choices
cfUniForm supports two conventions for building
your errors array. Provide the name of the property that failed
validation in your choice of a 'property' key or a 'field' key.
The array of structs: Property Key
| array
|
| 1 |
| struct |
| MESSAGE |
Please enter your Email Address.
|
| PROPERTY |
email
|
|
| 2 |
| struct |
| MESSAGE |
The passwords do not match.
|
| PROPERTY |
password
|
|
| 3 |
| struct |
| MESSAGE |
The Email Address is invalid.
|
| PROPERTY |
email
|
|
The array of structs: Field Key
| array
|
| 1 |
| struct |
| FIELD |
email
|
| MESSAGE |
Please enter your Email Address.
|
|
| 2 |
| struct |
| FIELD |
password
|
| MESSAGE |
The passwords do not match.
|
|
| 3 |
| struct |
| FIELD |
email
|
| MESSAGE |
The Email Address is invalid.
|
|
Note that the two 'email' error messages are not in order. However,
when the messages are displayed by cfUniForm, they are grouped by
field (property) name. See the demo form below.
The Rendered Form: