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

output_html_m5a906b59.png

Initialization with pattern.

output_html_m391c01a2.png

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

output_html_61c38fb7.png

Entities Diagram

output_html_m67531475.png

Service activity diagramN/A

Tag attributes: reference

TagFormatValidator
DescriptionCompares a field value entered by the user with another one (value of another field or another entered value)
Diagram

output_html_m79d24c08.png

Tag attributes: description

The <bluage:FormatValidator> tag is defined by the following properties:

AttributeRequiredDescriptionExamples
IdYUnique Page tag IDval_txt_nomClient
ForidY

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
FormatY

Text zone input format:
- date : the text zone to format is a date
- currency : the text zone to format is a currency
- numeric : the text zone to format is a number

date
PatternYText zone input format patterndd/MM/yyyy
TimezoneN

Only used if format = date
Allows to give the time zone for the date display.
Default time zone is GMT.


CET

EST

errormessageN

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.
styleclassNError message to display style CSS classerror_msg

The format attribute allows one of the following values:

ValueDescription
dateFor a value with a date type
numericFor a value with a numeric type
currencyFor a currency value

output_html_135b9d38.png


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 »
SymbolLocationMeaning
0NumberDigit
#NumberDigit, zero shows as space
.NumberDecimal separator or monetary decimal separator
-NumberMinus sign
,NumberGrouping separator
ENumberSeparates mantissa and exponent in scientific notation. Need not be quoted in prefix or suffix.
;Sub pattern boundarySeparates positive and negative subpatterns
%Prefix or suffixMultiply by 100 and show as percentage
¤Prefix or suffixCurrency 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 suffixUsed 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 »

output_html_6d45a29d.jpg


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