| Package | org.apache.flex.formatters |
| Class | public class PostCodeFormatter |
| Inheritance | PostCodeFormatter Formatter Object |
| Language Version : | ActionScript 3.0 |
| Product Version : | ApacheFlex 4.8 |
| Runtime Versions : | AIR 1.0, Flash Player 10.2 |
formatString or
formats property.
Postcode formats consists of the letters C, N, A and spaces or hyphens
Country codes one be one or two digits.
For example "NNNN" is a four digit numeric postcode, "CCNNNN" is country code followed by four digits and "AA NNNN" is two letters, followed by a space then followed by four digits.
More than one format can be specified by setting the formats
property to an array of format strings.
Spaces and hypens will be added if missing to format the postcode correctly.
If an error occurs, an empty String is returned and a String that
describes the error is saved to the error property.
The error property can have one of the following values:
"invalidFormat" means the format constants an invalid
character."wrongFormat" means the postcode has an invalid format."wrongLength" means the postcode is not a valid length."invalidChar" means the postcode contains an invalid
character.Fullwidth numbers and letters are supported in postcodes by ignoring character
width via the flash.globalization.Collator
equals method.
Hide MXML SyntaxThe <mx:PostCodeFormatter> tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:PostCodeFormatter
formatString="NNNNN"
formats="['NNNNN', 'NNNNN-NNNN']"
/>
See also
| Property | Defined By | ||
|---|---|---|---|
![]() | defaultInvalidFormatError : String [static]
Error message for an invalid format string specified to the formatter. | Formatter | |
![]() | defaultInvalidValueError : String [static]
Error messages for an invalid value specified to the formatter. | Formatter | |
![]() | error : String
Description saved by the formatter when an error occurs. | Formatter | |
| formats : Array
An array of format strings to format the postcode in. | PostCodeFormatter | ||
| formatString : String
Format string to format the postcode in. | PostCodeFormatter | ||
| Method | Defined By | ||
|---|---|---|---|
Constructor. | PostCodeFormatter | ||
format(value:Object):String [override]
Formats the value by using the format set in formatString
or formats. | PostCodeFormatter | ||
| formats | property |
formats:Array| Language Version : | ActionScript 3.0 |
| Product Version : | ApacheFlex 4.8 |
| Runtime Versions : | AIR 1.0, Flash Player 10.2 |
An array of format strings to format the postcode in.
Use for locales where more than one format is required. eg en_UK
See formatString for format of the format
strings.
The default value is [].
public function get formats():Array public function set formats(value:Array):void| formatString | property |
formatString:String| Language Version : | ActionScript 3.0 |
| Product Version : | ApacheFlex 4.8 |
| Runtime Versions : | AIR 1.0, Flash Player 10.2 |
Format string to format the postcode in.
The format string consists of the letters C, N, A and spaces or hyphens:
The default value is null.
public function get formatString():String public function set formatString(value:String):void| PostCodeFormatter | () | Constructor |
public function PostCodeFormatter()| Language Version : | ActionScript 3.0 |
| Product Version : | ApacheFlex 4.8 |
| Runtime Versions : | AIR 1.0, Flash Player 10.2 |
Constructor.
| format | () | method |
override public function format(value:Object):String| Language Version : | ActionScript 3.0 |
| Product Version : | ApacheFlex 4.8 |
| Runtime Versions : | AIR 1.0, Flash Player 10.2 |
Formats the value by using the format set in formatString
or formats.
If the value cannot be formatted this method returns an empty String
and write a description of the error to the error property.
Parameters
value:Object — Value to format.
|
String — Formatted String. Empty if an error occurs. A description
of the error condition is written to the error property.
|