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.

 Struts 1.x  

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

Prev Next