Validate

Description

Define validations on a java field, which are generated in a seperate Validator Class. Found inside a field element.

Parameters

Attribute Description Required
regex For string fields, a regular expression to check the string against. One of these
mandatory-if the current field becomes mandatory if the field listed is not null (or "" for strings)
code For fields w/ REGEXP use this code instead of abra code NO (Defaults to ValidationCodes.REGEXP_FAILED)
name For field w/ REGEXP use this name as the error name instead of ugly '[a-z0-9 ]{4} ..' NO (defaults to regex value)
required If validation mandatory (but not database mandatory) this will assertMandatory without writing 'NOT NULL' in the DB One of these

Parameters specified as nested elements

NONE

Examples

For valid regexp values see jakarta regexp RE class. Used from regexp.
  
<field name="name" type="string" >
   <validate regexp="[a-zA-Z]([a-zA-Z ]|\". \")*" / >
</field >
will require name to contain only letters, spaces or end with "." as in John Jr.

Copyright © 2000,2001,2002 Paul Bethe and Richie Bielak. All rights Reserved.