dWebSpec Dictionary
CONTEXT: descriptors->element->validators




All Details Standard Only Platform Only
Structured Web info and helpTechnologies
 Home Page
 Product Page
 Download Page
 Feedback
Javascript Tree Menu

Results for:

 element.validators 
Prev  Topic  Next

A space-delimited list of validators could be specified for an element. They could come in various forms that would ensure that entries conform to specific types (numeric, long, date, etc), or regular expression. They could also restrict the ranges of values, maximum or minimum length, of the enties. Others provide comprehensive validation for special fields like zip or postal code, email address, credit card number, etc.

The space -delimited list of validators entered here should be accompanied by the relevant parameters.

The standard validators for dWebSpec are listed below:

  • TypeValidator:,
  • RequiredValidator:,
  • Range:,startRange,endRange
  • Regex:,exp
  • MaxLength:,length
  • MinLength:,length
  • Equal:,target

The format is Validatior:message,variable1,variable2,variable...

message could be in this forms.

Stop
"Stop entry"  (quote needed for embedded space)
{msg.stop}  (externalized string)

variables needed are shown to the right of the validators as depicted above.

 JSF  

This corresponds to JSF component attribute validator.

One way of implementing this is to specify a method-binding expression that would invoke a method on the backing bean that will validate the component value.

Apart from designating a validator as an attribute, the association could be in form of nested components within other components. There are some standard validator components:

f:validateDoubleRange
f:validateLongRange
f:validateLength

Custom validators could be specified in the faces-config.xml and given symbolic names. They could then be associated with a component, using the f:validator component.

The table below shows dWebSpec standard validators and their correspondent validators on the JSF platform.

The list of the validator type is provided in the overview section of the Element Descriptor.

The implementation aspect is discussed here.

The following are the mappings for dWebSpec validation types to JSF validations components. The dWebSpec types are more concise; it would take considering both the validator types and conversion types to arrived at the equivalent JSF validation components.

Validators Conversion Type JSF Equivalents
TypeValidator
(On JSF platform, the converter validates and converts)
string (default)
Credit cardt:validateCreditCard
Emailt:validateEmail
url
byte f:convertNumber
  short f:convertNumber
  integer f:convertNumber
  long f:convertNumber
  float f:convertNumber
  double f:convertNumber
  date f:convertDateTime
  boolean * note that Boolean input is usually implemented with checkbox or select, both of which do not need validation
RequiredValidator (required attribute)   require attribute
Range byte,short,integer f:validateLongRange
  long f:validateLongRange
  float f:validateLongRange
  double f:validateLongRange
Regex   t:validateRegExpr
MaxLength   f:validateLength
MinLength   f:validateLength
Equal   t:validateEqual

Custom validator could be registered and used on the page with the following tag. The registration aspects is discussed under the subject of behavior-define descriptor:

f:validator
Prev Next