|
The list of the validator type is provided in the
overview section of the Element Descriptor.
The
implementation aspect is discussed here.
<form-validation>
<formset>
<form name="categoryForm">
<field property="categoryName" depends="required">
<arg0 key="categoryForm.categoryName.label"/>
</field>
</form>
</formset>
</form-validation>
In the example above, it could be seen that the validation
specification is entered in the configuration file for each form, whereas the
individual elements within the form are registered with the field entry, within
the form entry. All the validators applicable to each field would be entered as
comma delimited list in the attribute depends. In the body of the field entry
would be the arguments for the validators. Different validators have different
arguments. The zero position is usually used for the caption. This takes the
form of the key rather than the actual label, as default.
In this
implementation the property attribute in this configuration would be the
property binding or element id.
For the
example above, we have selected the required validator that uses no
additional argument. Others, like MaxLength, would require additional
parameters.
The
following are the conversion for Struts validations type.. The dWebSpec type specifications
are very concise; their interpretations would take into consideration the
conversion-type of the elements.
Validators |
Conversion Type |
Struts Equivalents |
TypeValidator |
string (default) |
creditCard,
email,
url |
|
byte |
byte |
|
short |
short |
|
integer |
integer |
|
long |
long |
|
float |
float |
|
double |
double |
|
date |
date |
|
boolean |
boolean |
RequiredValidator
(required
attribute) |
|
required |
Range |
byte,short,integer |
intRange |
|
long |
longRange |
|
float |
floatRange |
|
double |
doubleRange |
Regex |
|
mask |
MaxLength |
|
maxlength |
MinLength |
|
minlength |
Equal |
|
validWhen |
|