4.7Validators setting

     4.7.1 Definitions & concepts

     4.7.2 Principle

4.7.3 The RequiredFieldValidator tag

4.7.4 The FormatValidator tag

4.7.5 The RangeValidator tag

4.7.6 The CompareValidator tag

4.7.7 The LengthValidator tag

4.7.8 The RegularExpressionValidator tag

4.7.9 The CustomValidator tag

4.7.1Definitions & concepts

Validators allow checking data type and format. This check can be carried out on the customer’s or server’s level.

Validators types are:

  • Syntaxic (date, alphanumeric, size, numbers, double precision, email, …),
  • Semantic (dynamic : beginning date < end date, static : field included between two calculated values),
  • Required field,
  • Display parameters (colors, visibility, enabled, disabled…) .

4.7.2Principle

The following table is a list of the various technical type management rules categories or validators that may be defined on the mock-up:

CategoryTagComment
Required FieldRequiredFieldValidatorData in field is Required
ComparaisonCompareValidatorCompares the value of a field filled by a user with another one
FormatFormatValidatorDefines the field format: email, Zip code, date, … etc.
RangeRangeValidatorDefines the value of a field that must be range within a given interval.
Regular ExpressionRegularExpressionValidatorChecks the value format in comparison with a regular expression.
CustomCustomValidatorExecutes a specific validation as decided by the user.

Validator common attributes are:

AttributeRequiredDescription
IdYUnique tag ID in the page
foridYID of the item to be validated
errormessageNerror message to display in case of validation error
styleclassNError message to display style CSS class

Using the example of a Required « UserName » field, the validation tag will have the following shape:

<bluage:RequiredFieldValidator

id = "RG_001"

forid = "UserName "

errormessage = "Please choose a username"

styleclass= = "error "

/>

A « Please choose a username » message will be displayed in case of validation failure.


output_html_135b9d38.png

If the « errormessage » attribute is not filled in, a default error message will be displayed (the message key in the bundle is: NomDuValidator_ErrorMessage, example RequiredFieldValidator_ErrorMessage), if no message must be displayed then ErrorMessage=" " must be used.

output_html_135b9d38.png

The « ErrorMessages » tag allows to display validation errors and errors from application.

output_html_135b9d38.png


The two most common ways of dealing with error messages related to data validation are the following ones :

  • Display each error message beside the corresponding input zone.
  • Display all the similarly formatted error messages in the same place.

BLU AGE is a registered trademark of NETFECTIVE TECHNOLOGY S.A. - Trademarks are property of their respective owners
Do not copy or divulge without written permission