<mx:DateValidator>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:DateValidator allowedFormatChars="/\-. " dayListener="Object specified by daySource" dayProperty="No default" daySource="No default" formatError= "Configuration error: Incorrect formatting string." inputFormat="MM/DD/YYYY" invalidCharError="The date contains invalid characters." monthListener="Object specified by monthSource" monthProperty="No default" monthSource="No default" validateAsString="true|false" wrongDayError="Enter a valid day for the month." wrongLengthError="Type the date in the format inputFormat." wrongMonthError="Enter a month between 1 and 12." wrongYearError="Enter a year between 0 and 9999." yearListener="Object specified by yearSource" yearProperty="No default" yearSource="No default" />]]>
DateValidator クラスで日付を指定する方法は 2 通りあります。
このメソッドはユーザーが直接呼び出すものではなく、妥当性を検証する際に Flex から呼び出されます。 Validator クラスをカスタムで作成する場合は、このメソッドを実装する必要があります。
<mx:ZipCodeValidator>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:ZipCodeValidator allowedFormatChars=" -" domain="US Only | US or Canada | Canada Only" invalidCharError="The ZIP code contains invalid characters." invalidDomainError="The domain parameter is invalid. It must be either 'US Only', 'Canada Only', or 'US or Canada'." wrongCAFormatError="The Canadian postal code must be formatted 'A1B 2C3'." wrongLengthError="The ZIP code must be 5 digits or 5+4 digits." wrongUSFormatError="The ZIP+4 code must be formatted '12345-6789'." />]]>
このメソッドはユーザーが直接呼び出すものではなく、妥当性を検証する際に Flex から呼び出されます。 Validator クラスをカスタムで作成する場合は、このメソッドを実装する必要があります。
ActionScript では、定数
このインターフェイスでは、mx と spark の両方の名前空間で定義される数字、通貨、電話番号、郵便番号などの複数のデータ型を検証できます。 mx:Validator クラスと spark:GlobaliationValidatorBase クラスは、このインターフェイスを実装します。 これらのクラスの validateAll() メソッドは、このインターフェイスタイプを使用して、複数のバリデーターオブジェクトで validate() メソッドを呼び出します。
この値を
<mx:CurrencyValidator>
tag
inherits all of the tag properties of its superclass,
and adds the following tag properties:
<mx:CurrencyValidator alignSymbol="left|right|any" allowNegative="true|false" currencySymbol="$" currencySymbolError="The currency symbol occurs in an invalid location." decimalPointCountError="The decimal separator can occur only once." decimalSeparator="." exceedsMaxError="The amount entered is too large." invalidCharError="The input contains invalid characters." invalidFormatCharsError="One of the formatting parameters is invalid." lowerThanMinError="The amount entered is too small." maxValue="NaN" minValue="NaN" negativeError="The amount may not be negative." precision="2" precisionError="The amount entered has too many digits beyond the decimal point." separationError="The thousands separator must be followed by three digits." thousandsSeparator="," />]]>
このメソッドはユーザーが直接呼び出すものではなく、妥当性を検証する際に Flex から呼び出されます。 Validator クラスをカスタムで作成する場合は、このメソッドを実装する必要があります。
<mx:StringValidator>
tag
inherits all of the tag attributes of its superclass,
and add the following tag attributes:
<mx:StringValidator maxLength="NaN" minLength="NaN" tooLongError="This string is longer than the maximum allowed length. This must be less than {0} characters long." tooShortError="This string is shorter than the minimum allowed length. This must be at least {0} characters long." />]]>
このメソッドはユーザーが直接呼び出すものではなく、妥当性を検証する際に Flex から呼び出されます。 Validator クラスをカスタムで作成する場合は、このメソッドを実装する必要があります。
<mx:RegExpValidator>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:RegExpValidator expression="No default" flags="No default" noExpressionError="The expression is missing." noMatchError="The field is invalid." />]]>
バリデーターが検証対象のフィールドで正規表現に一致するものを検出できた場合、検証は成功です。 バリデーターが、一致を検出できなかった場合は、検証エラーが発生します。
RegExpValidator クラスは、
一方、
このメソッドはユーザーが直接呼び出すものではなく、妥当性を検証する際に Flex から呼び出されます。 Validator クラスをカスタムで作成する場合は、このメソッドを実装する必要があります。
<mx:NumberValidator>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:NumberValidator allowNegative="true|false" decimalPointCountError="The decimal separator can only occur once." decimalSeparator="." domain="real|int" exceedsMaxError="The number entered is too large." integerError="The number must be an integer." invalidCharError="The input contains invalid characters." invalidFormatCharsError="One of the formatting parameters is invalid." lowerThanMinError="The amount entered is too small." maxValue="NaN" minValue="NaN" negativeError="The amount may not be negative." precision="-1" precisionError="The amount entered has too many digits beyond the decimal point." separationError="The thousands separator must be followed by three digits." thousandsSeparator="," />]]>
このメソッドはユーザーが直接呼び出すものではなく、妥当性を検証する際に Flex から呼び出されます。 Validator クラスをカスタムで作成する場合は、このメソッドを実装する必要があります。
ActionScript の場合、このプロパティを設定するために使用できる定数は、
<mx:PhoneNumberValidator>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:PhoneNumberValidator allowedFormatChars="()- .+" invalidCharError="Your telephone number contains invalid characters." minDigits="10" wrongLengthError="Your telephone number must contain at least 10 digits." />]]>
このメソッドは通常、ユーザーが直接呼び出すものではなく、妥当性を検証する際に Flex から呼び出されます。 Validator クラスをカスタムで作成する場合は、このメソッドを実装する必要があります。
<mx:EmailValidator>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:EmailValidator invalidCharError="Your e-mail address contains invalid characters." invalidDomainError= "The domain in your e-mail address is incorrectly formatted." invalidIPDomainError="The IP domain in your e-mail address is incorrectly formatted." invalidPeriodsInDomainError="The domain in your e-mail address has consecutive periods." missingAtSignError="An at sign (&64;) is missing in your e-mail address." missingPeriodInDomainError="The domain in your e-mail address is missing a period." missingUsernameError="The username in your e-mail address is missing." tooManyAtSignsError="Your e-mail address contains too many &64; characters." />]]>
IP ドメイン名も、角括弧で囲めば使用できます(例:myname@[206.132.22.1])。 0 ~ 255 の範囲の IP 番号を使用できます。
このメソッドはユーザーが直接呼び出すものではなく、妥当性を検証する際に Flex から呼び出されます。 Validator クラスをカスタムで作成する場合は、このメソッドを実装する必要があります。
ただし、
ValidationResultEvent クラスは、
<mx:Validator enabled="true|false" listener="Value of the source property" property="No default" required="true|false" requiredFieldError="This field is required." source="No default" trigger="Value of the source property" triggerEvent="valueCommit" />]]>
バリデータークラスのサブクラスを作成する場合、このメソッドをオーバーライドする必要があります。
このイベントは、ResourceManager の
サブクラスでは、このメソッドをオーバーライドし、
複数のデータフィールドを検証する Validator クラスのサブクラス(CreditCardValidator および DateValidator など)は、コンストラクターにこのプロパティを割り当てる必要があります。
リスナーを指定しない場合、Flex は
<mx:CreditCardValidator>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:CreditCardValidator allowedFormatChars=" -" cardNumberListener="Object specified by cardNumberSource" cardNumberProperty="No default" cardNumberSource="No default" cardTypeListener="Object specified by cardTypeSource" cardTypeProperty="No default" cardTypeSource="No default" invalidCharError= "Invalid characters in your credit card number. (Enter numbers only.)" invalidNumberError="The credit card number is invalid." noNumError="No credit card number is specified." noTypeError="No credit card type is specified or the type is not valid." wrongLengthError="Your credit card number contains the wrong number of digits." wrongTypeError="Incorrect card type is specified." />]]>
CreditCardValidator への入力を次の 2 通りの方法で行うことができます。
MXML では以下の値を使用できます。
ActionScript では、静的定数として
検証時には、次のガイドラインが使用されます。
長さ:
このメソッドはユーザーが直接呼び出すものではなく、妥当性を検証する際に Flex から呼び出されます。 Validator クラスをカスタムで作成する場合は、このメソッドを実装する必要があります。
MXML で、次の値を指定できます。
ActionScript では、このプロパティを設定するために次の定数を使用できます。
<mx:SocialSecurityValidator>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:SocialSecurityValidator allowedFormatChars=" -" invalidCharError="You entered invalid characters in your Social Security number." wrongFormatError="The Social Security number must be 9 digits or in the form NNN-NN-NNNN." zeroStartError="Invalid Social Security number; the number cannot start with 000." />]]>
このメソッドはユーザーが直接呼び出すものではなく、妥当性を検証する際に Flex から呼び出されます。 Validator クラスをカスタムで作成する場合は、このメソッドを実装する必要があります。
通常、バリデーターにイベントリスナーを割り当てることで、バリデーターによって送出された
Validator クラスを実際に使用しないでコンポーネントの検証エラーを表示するには、
検証エラーをクリアするには、