4.7.4 The FormatValidator tag
The « Formatvalidator » tag is used to check a field value structure and to make sure it matches a specific format.
This tag allows two main functionalities:
- confirms that a text zone matches an input format
- display a text zone in an input format
Input format designates a set of rules that must be observed within a text zone.
The<bluage:FormatValidator> is always linked :
- either to a text zone for input : <bluage:TextField>
- or to a text zone for displaying: <bluage:DynamicText>
Example:
| Rendering |
Initialization with pattern.
Validation with pattern. |
| XHTML settings | <bluage:FormatValidator id="date_validation" forid="txt_birthday" errormessage="Invalid date format" format="date" pattern="dd/MM/yyyy" styleclass="error"/> <bluage:FormatValidator id="age_validation" forid="txt_age" errormessage="Invalid age format" format="numeric" pattern="" styleclass="error"/> |
| Screen activity diagram |
|
| Entities Diagram |
|
| Service activity diagram | N/A |
Tag attributes: reference
| Tag | FormatValidator |
| Description | Compares a field value entered by the user with another one (value of another field or another entered value) |
| Diagram |
|
Tag attributes: description
The <bluage:FormatValidator> tag is defined by the following properties:
| Attribute | Required | Description | Examples |
| Id | Y | Unique Page tag ID | val_txt_nomClient |
| Forid | Y | Link with the tag whose text zone must be formatted. - In case of an input text zone formatting, the tag ID of the <bluage:TextField> must be filled. - In case of a display text zone formatting, the tag ID of the <bluage:DynamicText> must be filled. | txt_nomClient |
| Format | Y | Text zone input format: | date |
| Pattern | Y | Text zone input format pattern | dd/MM/yyyy |
| Timezone | N | Only used if format = date | CET EST |
| errormessage | N | Only used in case of input text zone formatting Error message to display if the text zone does not match the format. | Bad date format. |
| styleclass | N | Error message to display style CSS class | error_msg |
The format attribute allows one of the following values:
| Value | Description |
| date | For a value with a date type |
| numeric | For a value with a numeric type |
| currency | For a currency value |
| For the « date » type, an optional attribute may be added: “pattern” defines the date format, if it is not specified the date default format is dd/MM/yyyy For the « numeric » type, an optional attribute may be added: “pattern” defines the number format to display. If it is not specified, the decimal numbers default format is two decimal long. |
Note on dates input format (format = date) :
- the local date taken into account at the launching of the application is the navigator date
- Example of display of the hour in a hh:mm format (in the table) in France:
<bluage:DynamicText
id=”dyn_heureAudio"
tablefield="SellOrder.sellDate">
</bluage:DynamicText>
<bluage:FormatValidator
id="val_dyn_heureAudio"
forid=”dyn_heureAudio"
errormessage="error2" format="date"
pattern="hh:mm"
timezone="CET">
</bluage:FormatValidator>
- Example of a date input with a dd/MM/yyyy format in France
<bluage:TextField
id="txt_dateFin"
tablefield="PeriodePourRecherche.dateFin"
instancename="periodSelected"
scope="request"
action="false">
<input
name="textfield4"
type="text"
id="textfield4"
size="12"
/>
</bluage:TextField>
<bluage:FormatValidator
id="val_txt_dateFin"
forid="txt_dateFin"
format="date"
pattern="dd/MM/yyyy"
timezone="CET">
</bluage:FormatValidator>
- Pattern example for the input fields
The two tables hereafter describe all the possible patterns:
- For « numeric »
| Symbol | Location | Meaning |
| 0 | Number | Digit |
| # | Number | Digit, zero shows as space |
| . | Number | Decimal separator or monetary decimal separator |
| - | Number | Minus sign |
| , | Number | Grouping separator |
| E | Number | Separates mantissa and exponent in scientific notation. Need not be quoted in prefix or suffix. |
| ; | Sub pattern boundary | Separates positive and negative subpatterns |
| % | Prefix or suffix | Multiply by 100 and show as percentage |
| ¤ | Prefix or suffix | Currency sign, replaced by currency symbol. If doubled, replaced by international currency symbol. If present in a pattern, the monetary decimal separator is used instead of the decimal separator. |
| ' | Prefix or suffix | Used to quote special characters in a prefix or suffix, for example, "'#'#" formats 123 to "#123". To create a single quote itself, use two in a row: "# o''clock". |
- For « date »






