blob: 1a0f5aaae758de45bf0f583ac6e4373aa4be527f [file]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- saved from url=(0014)about:internet --><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="stylesheet" href="../../style.css" type="text/css" media="screen"><link rel="stylesheet" href="../../print.css" type="text/css" media="print"><link rel="stylesheet" href="../../override.css" type="text/css"><meta name="keywords" content="Validator,mx.validators.Validator,AMERICAN_EXPRESS,ANY,CANADA_ONLY,DECIMAL_DIGITS,DINERS_CLUB,DISCOVER,INT,LEFT,MASTER_CARD,REAL,RIGHT,ROMAN_LETTERS,US_ONLY,US_OR_CANADA,VISA,actualListeners,actualTrigger,alignSymbol,allowNegative,allowNegative,allowedFormatChars,allowedFormatChars,allowedFormatChars,allowedFormatChars,allowedFormatChars,cardNumberListener,cardNumberProperty,cardNumberSource,cardTypeListener,cardTypeProperty,cardTypeSource,currencySymbol,currencySymbolError,dayListener,dayProperty,daySource,decimalPointCountError,decimalPointCountError,decimalSeparator,decimalSeparator,domain,domain,enabled,enabled,errorCode,errorMessage,errorString,exceedsMaxError,exceedsMaxError,expression,flags,formatError,includeFormatInError,inputFormat,integerError,invalidCharError,invalidCharError,invalidCharError,invalidCharError,invalidCharError,invalidCharError,invalidCharError,invalidCharError,invalidDomainError,invalidDomainError,invalidFormatCharsError,invalidFormatCharsError,invalidIPDomainError,invalidNumberError,invalidPeriodsInDomainError,isError,listener,lowerThanMinError,lowerThanMinError,matchedIndex,matchedString,matchedSubstrings,maxLength,maxValue,maxValue,minDigits,minLength,minValue,minValue,missingAtSignError,missingPeriodInDomainError,missingUsernameError,monthListener,monthProperty,monthSource,negativeError,negativeError,noExpressionError,noMatchError,noNumError,noTypeError,precision,precision,precisionError,precisionError,property,required,requiredFieldError,resourceManager,separationError,separationError,source,subField,subFields,thousandsSeparator,thousandsSeparator,tooLongError,tooManyAtSignsError,tooShortError,trigger,triggerEvent,validateAsString,validationSubField,wrongCAFormatError,wrongDayError,wrongFormatError,wrongLengthError,wrongLengthError,wrongLengthError,wrongLengthError,wrongMonthError,wrongTypeError,wrongUSFormatError,wrongYearError,yearListener,yearProperty,yearSource,zeroStartError,addListenerHandler,doValidation,doValidation,doValidation,doValidation,doValidation,doValidation,doValidation,doValidation,doValidation,doValidation,doValidation,getValueFromSource,handleResults,initialized,isRealValue,removeListenerHandler,resourcesChanged,validate,validate,validateAll,validateCreditCard,validateCurrency,validateDate,validateEmail,validateNumber,validatePhoneNumber,validateSocialSecurity,validateString,validateZipCode,validationResultHandler"><title>mx.validators.Validator</title><script src="../../AC_OETags.js" type="text/javascript"></script></head><body><script language="javascript" type="text/javascript" src="../../asdoc.js"></script><script language="javascript" type="text/javascript" src="../../help.js"></script><script language="javascript" type="text/javascript" src="../../cookies.js"></script><script language="javascript" type="text/javascript"><!--
asdocTitle = 'Validator - ApacheFlex API Reference';
var baseRef = '../../';
window.onload = configPage;
--></script>
<script type="text/javascript">
scrollToNameAnchor();
</script><table class="titleTable" cellpadding="0" cellspacing="0" id="titleTable" style="display:none"><tr><td class="titleTableTitle" align="left">Apache Flex 4.16.1 API Reference </td><td class="titleTableTopNav" align="right"><a href="../../package-summary.html" onclick="loadClassListFrame('../../all-classes.html')">All Packages</a>&nbsp;|&nbsp;<a href="../../class-summary.html" onclick="loadClassListFrame('../../all-classes.html')">All Classes</a>&nbsp;|&nbsp;<a href="../../all-index-A.html" onclick="loadClassListFrame('../../index-list.html')">Index</a>&nbsp;|&nbsp;<a id="framesLink1" href="../../index.html?mx/validators/Validator.html&amp;mx/validators/class-list.html">Frames</a><a id="noFramesLink1" style="display:none" href="" onclick="parent.location=document.location"> No Frames </a></td><td class="titleTableLogo" align="right" rowspan="3"><img src="../../images/logo.jpg" class="logoImage" alt="AdobeLogo" title="AdobeLogo"></td></tr><tr class="titleTableRow2"><td class="titleTableSubTitle" id="subTitle" align="left">Validator</td><td class="titleTableSubNav" id="subNav" align="right"><a href="#propertySummary">Properties</a>&nbsp;| <a href="#methodSummary">Methods</a>&nbsp;| <a href="#eventSummary">Events</a>&nbsp;| <a href="#constantSummary">Constants</a>&nbsp;| <a href="#includeExamplesSummary">Examples</a></td></tr><tr class="titleTableRow3"><td colspan="3">&nbsp;</td></tr></table><script language="javascript" type="text/javascript" xml:space="preserve">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Validator"); titleBar_setSubNav(true,true,false,false,false,false,true,false,true,true,false ,false,false,false,false,false);}
-->
</script><div xmlns:fn="http://www.w3.org/2005/xpath-functions" class="MainContent"><table class="classHeaderTable" cellpadding="0" cellspacing="0"><tr><td class="classHeaderTableLabel">Package</td><td><a href="package-detail.html" onclick="javascript:loadClassListFrame('class-list.html')">mx.validators</a></td></tr><tr><td class="classHeaderTableLabel">Class</td><td class="classSignature">public class Validator</td></tr><tr><td class="classHeaderTableLabel">Inheritance</td><td class="inheritanceList">Validator <img src="../../images/inherit-arrow.gif" title="Inheritance" alt="Inheritance" class="inheritArrow"> flash.events.EventDispatcher</td></tr><tr><td class="classHeaderTableLabel">Implements</td><td> <a href="../../mx/core/IMXMLObject.html">IMXMLObject</a>, <a href="../../mx/validators/IValidator.html">IValidator</a></td></tr><tr><td class="classHeaderTableLabel">Subclasses</td><td> <a href="../../mx/validators/CreditCardValidator.html">CreditCardValidator</a>, <a href="../../mx/validators/CurrencyValidator.html">CurrencyValidator</a>, <a href="../../mx/validators/DateValidator.html">DateValidator</a>, <a href="../../mx/validators/EmailValidator.html">EmailValidator</a>, <a href="../../mx/validators/NumberValidator.html">NumberValidator</a>, <a href="../../mx/validators/PhoneNumberValidator.html">PhoneNumberValidator</a>, <a href="../../org/apache/flex/validators/PostCodeValidator.html">PostCodeValidator</a>, <a href="../../mx/validators/RegExpValidator.html">RegExpValidator</a>, <a href="../../mx/validators/SocialSecurityValidator.html">SocialSecurityValidator</a>, <a href="../../mx/validators/StringValidator.html">StringValidator</a>, <a href="../../mx/validators/ZipCodeValidator.html">ZipCodeValidator</a></td></tr></table><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p></p><p></p>
The Validator class is the base class for all Flex validators.
This class implements the ability for a validator to make a field
required, which means that the user must enter a value in the field
or the validation fails.
<p></p><a name="mxmlSyntaxSummary"></a><span class="classHeaderTableLabel">MXML Syntax</span><span id="showMxmlLink" style="display:none"><a href="#mxmlSyntaxSummary" onclick="toggleMXMLOnly();"><img src="../../images/collapsed.gif" title="collapsed" alt="collapsed" class="collapsedImage">Show MXML Syntax</a><br/></span><span id="hideMxmlLink"><a href="#mxmlSyntaxSummary" onclick="toggleMXMLOnly();"><img src="../../images/expanded.gif" title="expanded" alt="expanded" class="expandedImage">Hide MXML Syntax</a></span><div id="mxmlSyntax" class="mxmlSyntax"> <p>The Validator class defines the following tag attributes,
which all of its subclasses inherit:</p>
<pre>
&lt;mx:Validator
enabled="true|false"
listener="<i>Value of the source property</i>"
property="<i>No default</i>"
required="true|false"
requiredFieldError="This field is required."
source="<i>No default</i>"
trigger="<i>Value of the source property</i>"
triggerEvent="valueCommit"
/&gt;
</pre>
</div><script language="javascript" type="text/javascript"><!--
setMXMLOnly();
--></script><p><a href="#includeExamplesSummary">View the examples</a></p><p><span class="classHeaderTableLabel">See also</span></p><div class="seeAlso"><a href="../../mx/events/ValidationResultEvent.html" target="">mx.events.ValidationResultEvent</a><br/><a href="ValidationResult.html" target="">mx.validators.ValidationResult</a><br/><a href="RegExpValidationResult.html" target="">mx.validators.RegExpValidationResult</a></div><br/><hr></div><a name="propertySummary"></a><div class="summarySection"><div class="summaryTableTitle">Public Properties</div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableProperty"><tr><th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#enabled" class="signatureLink">enabled</a> : Boolean<div class="summaryTableDescription">
Setting this value to false will stop the validator
from performing validation.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#listener" class="signatureLink">listener</a> : Object<div class="summaryTableDescription">
Specifies the validation listener.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#property" class="signatureLink">property</a> : String<div class="summaryTableDescription">
A String specifying the name of the property
of the source object that contains
the value to validate.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#required" class="signatureLink">required</a> : Boolean<div class="summaryTableDescription">
If true, specifies that a missing or empty
value causes a validation error.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#requiredFieldError" class="signatureLink">requiredFieldError</a> : String<div class="summaryTableDescription">
Error message when a value is missing and the
required property is true.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#source" class="signatureLink">source</a> : Object<div class="summaryTableDescription">
Specifies the object containing the property to validate.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#trigger" class="signatureLink">trigger</a> : IEventDispatcher<div class="summaryTableDescription">
Specifies the component generating the event that triggers the validator.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#triggerEvent" class="signatureLink">triggerEvent</a> : String<div class="summaryTableDescription">
Specifies the event that triggers the validation.</div></td><td class="summaryTableOwnerCol">Validator</td></tr></table></div><a name="protectedPropertySummary"></a><div class="summarySection"><div class="summaryTableTitle">Protected Properties</div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableProtectedProperty"><tr><th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#actualListeners" class="signatureLink">actualListeners</a> : Array<div class="summaryTableDescription">[read-only]
Contains an Array of listener objects, if any,
or the source object.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#actualTrigger" class="signatureLink">actualTrigger</a> : IEventDispatcher<div class="summaryTableDescription">[read-only]
Contains the trigger object, if any,
or the source object.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#resourceManager" class="signatureLink">resourceManager</a> : <a href="../../mx/resources/IResourceManager.html">IResourceManager</a><div class="summaryTableDescription">[read-only]
A reference to the object which manages
all of the application's localized resources.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#subFields" class="signatureLink">subFields</a> : Array<div class="summaryTableDescription">
An Array of Strings containing the names for the properties contained
in the value Object passed to the validate() method.</div></td><td class="summaryTableOwnerCol">Validator</td></tr></table></div><a name="methodSummary"></a><div class="summarySection"><div class="summaryTableTitle">Public Methods </div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableMethod"><tr><th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#Validator()" class="signatureLink">Validator</a>()</div><div class="summaryTableDescription">
Constructor.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#initialized()" class="signatureLink">initialized</a>(document:Object, id:String):void</div><div class="summaryTableDescription">
Called automatically by the MXML compiler when the Validator
is created using an MXML tag.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#validate()" class="signatureLink">validate</a>(value:Object = null, suppressEvents:Boolean = false):<a href="../../mx/events/ValidationResultEvent.html">ValidationResultEvent</a></div><div class="summaryTableDescription">
Performs validation and optionally notifies
the listeners of the result.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#validateAll()" class="signatureLink">validateAll</a>(validators:Array):Array</div><div class="summaryTableDescription">[static]
Invokes all the validators in the validators Array.</div></td><td class="summaryTableOwnerCol">Validator</td></tr></table></div><a name="protectedMethodSummary"></a><div class="summarySection"><div class="summaryTableTitle">Protected Methods </div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableProtectedMethod"><tr><th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#addListenerHandler()" class="signatureLink">addListenerHandler</a>():void</div><div class="summaryTableDescription">
Sets up all of the listeners for the
valid and invalid
events dispatched from the validator.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#doValidation()" class="signatureLink">doValidation</a>(value:Object):Array</div><div class="summaryTableDescription">
Executes the validation logic of this validator,
including validating that a missing or empty value
causes a validation error as defined by
the value of the required property.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#getValueFromSource()" class="signatureLink">getValueFromSource</a>():Object</div><div class="summaryTableDescription">
Returns the Object to validate.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#handleResults()" class="signatureLink">handleResults</a>(errorResults:Array):<a href="../../mx/events/ValidationResultEvent.html">ValidationResultEvent</a></div><div class="summaryTableDescription">
Returns a ValidationResultEvent from the Array of error results.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#isRealValue()" class="signatureLink">isRealValue</a>(value:Object):Boolean</div><div class="summaryTableDescription">
Returns true if value is not null.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#removeListenerHandler()" class="signatureLink">removeListenerHandler</a>():void</div><div class="summaryTableDescription">
Disconnects all of the listeners for the
valid and invalid
events dispatched from the validator.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#resourcesChanged()" class="signatureLink">resourcesChanged</a>():void</div><div class="summaryTableDescription">
This method is called when a Validator is constructed,
and again whenever the ResourceManager dispatches
a "change" Event to indicate
that the localized resources have changed in some way.</div></td><td class="summaryTableOwnerCol">Validator</td></tr></table></div><a name="eventSummary"></a><div class="summarySection"><div class="summaryTableTitle">Events</div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableEvent"><tr><th>&nbsp;</th><th colspan="2">Event</th><th> Summary </th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#event:invalid" class="signatureLink">invalid</a></div></td><td class="summaryTableDescription summaryTableCol">Dispatched when validation fails.</td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#event:valid" class="signatureLink">valid</a></div></td><td class="summaryTableDescription summaryTableCol">Dispatched when validation succeeds.</td><td class="summaryTableOwnerCol">Validator</td></tr></table></div><a name="protectedConstantSummary"></a><div class="summarySection"><div class="summaryTableTitle">Protected Constants</div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableProtectedConstant"><tr><th>&nbsp;</th><th colspan="2">Constant</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#DECIMAL_DIGITS" class="signatureLink">DECIMAL_DIGITS</a> : String = 0123456789<div class="summaryTableDescription">[static]
A String containing the decimal digits 0 through 9.</div></td><td class="summaryTableOwnerCol">Validator</td></tr><tr class=""><td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a href="#ROMAN_LETTERS" class="signatureLink">ROMAN_LETTERS</a> : String = ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz<div class="summaryTableDescription">[static]
A string containing the upper- and lower-case letters
of the Roman alphabet ("A" through "Z" and "a" through "z").</div></td><td class="summaryTableOwnerCol">Validator</td></tr></table></div><script language="javascript" type="text/javascript"><!--
showHideInherited();
--></script><div class="MainContent"><div class="detailSectionHeader">Property Detail</div><a name="propertyDetail"></a><a name="actualListeners"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">actualListeners</td><td class="detailHeaderType">property</td></tr></table><div class="detailBody"><code>actualListeners:Array</code>&nbsp;&nbsp;[read-only] <p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Contains an Array of listener objects, if any,
or the source object. Used to determine which object
to notify about the validation result.
</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;protected function get actualListeners():Array</code><br/></div><a name="propertyDetail"></a><a name="actualTrigger"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">actualTrigger</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>actualTrigger:IEventDispatcher</code>&nbsp;&nbsp;[read-only] <p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Contains the trigger object, if any,
or the source object. Used to determine the listener object
for the <code>triggerEvent</code>.
</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;protected function get actualTrigger():IEventDispatcher</code><br/></div><a name="propertyDetail"></a><a name="enabled"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">enabled</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>enabled:Boolean</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Setting this value to <code>false</code> will stop the validator
from performing validation.
When a validator is disabled, it dispatch no events,
and the <code>validate()</code> method returns null.
</p><p> The default value is <code>true</code>.</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get enabled():Boolean</code><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function set enabled(value:Boolean):void</code><br/></div><a name="propertyDetail"></a><a name="listener"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">listener</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>listener:Object</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Specifies the validation listener.
<p>If you do not specify a listener,
Flex uses the value of the <code>source</code> property.
After Flex determines the source component,
it changes the border color of the component,
displays an error message for a failure,
or hides any existing error message for a successful validation.</p>
</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get listener():Object</code><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function set listener(value:Object):void</code><br/></div><a name="propertyDetail"></a><a name="property"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">property</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>property:String</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
A String specifying the name of the property
of the <code>source</code> object that contains
the value to validate.
The property is optional, but if you specify <code>source</code>,
you should set a value for this property as well.
</p><p> The default value is <code>null</code>.</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get property():String</code><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function set property(value:String):void</code><br/></div><a name="propertyDetail"></a><a name="required"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">required</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>required:Boolean</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
If <code>true</code>, specifies that a missing or empty
value causes a validation error.
</p><p> The default value is <code>true</code>.</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get required():Boolean</code><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function set required(value:Boolean):void</code><br/></div><a name="propertyDetail"></a><a name="requiredFieldError"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">requiredFieldError</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>requiredFieldError:String</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Error message when a value is missing and the
<code>required</code> property is <code>true</code>.
</p><p> The default value is <code>"This field is required."</code>.</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get requiredFieldError():String</code><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function set requiredFieldError(value:String):void</code><br/></div><a name="propertyDetail"></a><a name="resourceManager"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">resourceManager</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>resourceManager:<a href="../../mx/resources/IResourceManager.html">IResourceManager</a></code>&nbsp;&nbsp;[read-only] <p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
A reference to the object which manages
all of the application's localized resources.
This is a singleton instance which implements
the IResourceManager interface.
</p><p>This property can be used as the source for data binding.</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;protected function get resourceManager():<a href="../../mx/resources/IResourceManager.html">IResourceManager</a></code><br/></div><a name="propertyDetail"></a><a name="source"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">source</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>source:Object</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Specifies the object containing the property to validate.
Set this to an instance of a component or a data model.
You use data binding syntax in MXML to specify the value.
This property supports dot-delimited Strings
for specifying nested properties.
If you specify a value to the <code>source</code> property,
then you should specify a value to the <code>property</code>
property as well.
The <code>source</code> property is optional.
</p><p> The default value is <code>null</code>.</p><p>This property can be used as the source for data binding.</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get source():Object</code><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function set source(value:Object):void</code><br/></div><a name="propertyDetail"></a><a name="subFields"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">subFields</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>protected var subFields:Array</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
An Array of Strings containing the names for the properties contained
in the <code>value</code> Object passed to the <code>validate()</code> method.
For example, CreditCardValidator sets this property to
<code>[ "cardNumber", "cardType" ]</code>.
This value means that the <code>value</code> Object
passed to the <code>validate()</code> method
should contain a <code>cardNumber</code> and a <code>cardType</code> property.
<p>Subclasses of the Validator class that
validate multiple data fields (like CreditCardValidator and DateValidator)
should assign this property in their constructor. </p>
</p></div><a name="propertyDetail"></a><a name="trigger"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">trigger</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>trigger:IEventDispatcher</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Specifies the component generating the event that triggers the validator.
If omitted, by default Flex uses the value of the <code>source</code> property.
When the <code>trigger</code> dispatches a <code>triggerEvent</code>,
validation executes.
</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get trigger():IEventDispatcher</code><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function set trigger(value:IEventDispatcher):void</code><br/></div><a name="propertyDetail"></a><a name="triggerEvent"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">triggerEvent</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>triggerEvent:String</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Specifies the event that triggers the validation.
If omitted, Flex uses the <code>valueCommit</code> event.
Flex dispatches the <code>valueCommit</code> event
when a user completes data entry into a control.
Usually this is when the user removes focus from the component,
or when a property value is changed programmatically.
If you want a validator to ignore all events,
set <code>triggerEvent</code> to the empty string ("").
</p><br/><span class="label"> Implementation </span><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function get triggerEvent():String</code><br/><code>&nbsp;&nbsp;&nbsp;&nbsp;public function set triggerEvent(value:String):void</code><br/></div><a name="constructorDetail"></a><div class="detailSectionHeader">Constructor Detail</div><a name="Validator()"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">Validator</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">Constructor</td></tr></table><div class="detailBody"><code>public function Validator()</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p>
Constructor.
</p></div><a name="methodDetail"></a><div class="detailSectionHeader">Method Detail</div><a name="addListenerHandler()"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">addListenerHandler</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td></tr></table><div class="detailBody"><code> protected function addListenerHandler():void</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Sets up all of the listeners for the
<code>valid</code> and <code>invalid</code>
events dispatched from the validator. Subclasses of the Validator class
should first call the <code>removeListenerHandler()</code> method,
and then the <code>addListenerHandler()</code> method if
the value of one of their listeners or sources changes.
The CreditCardValidator and DateValidator classes use this function internally.
</p></div><a name="doValidation()"></a><a name="doValidation(Object)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">doValidation</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code> protected function doValidation(value:Object):Array</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Executes the validation logic of this validator,
including validating that a missing or empty value
causes a validation error as defined by
the value of the <code>required</code> property.
<p>If you create a subclass of a validator class,
you must override this method. </p>
</p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">value</span>:Object</code> &mdash; Value to validate.
</td></tr></table></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code>Array</code> &mdash; For an invalid result, an Array of ValidationResult objects,
with one ValidationResult object for each field examined
by the validator that failed validation.
</td></tr></table><p><span class="label">See also</span></p><div class="seeAlso"><a href="ValidationResult.html" target="">mx.validators.ValidationResult</a></div></div><a name="getValueFromSource()"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">getValueFromSource</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code> protected function getValueFromSource():Object</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Returns the Object to validate. Subclasses, such as the
CreditCardValidator and DateValidator classes,
override this method because they need
to access the values from multiple subfields.
</p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code>Object</code> &mdash; The Object to validate.
</td></tr></table></div><a name="handleResults()"></a><a name="handleResults(Array)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">handleResults</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code> protected function handleResults(errorResults:Array):<a href="../../mx/events/ValidationResultEvent.html">ValidationResultEvent</a></code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Returns a ValidationResultEvent from the Array of error results.
Internally, this function takes the results from the
<code>doValidation()</code> method and puts it into a ValidationResultEvent object.
Subclasses, such as the RegExpValidator class,
should override this function if they output a subclass
of ValidationResultEvent objects, such as the RegExpValidationResult objects, and
needs to populate the object with additional information. You never
call this function directly, and you should rarely override it.
</p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">errorResults</span>:Array</code> &mdash; Array of ValidationResult objects.
</td></tr></table></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code><a href="../../mx/events/ValidationResultEvent.html">ValidationResultEvent</a></code> &mdash; The ValidationResultEvent returned by the <code>validate()</code> method.
</td></tr></table></div><a name="initialized()"></a><a name="initialized(Object,String)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">initialized</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code> public function initialized(document:Object, id:String):void</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Called automatically by the MXML compiler when the Validator
is created using an MXML tag.
</p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">document</span>:Object</code> &mdash; The MXML document containing this Validator.
</td></tr><tr><td class="paramSpacer">&nbsp;</td></tr><tr><td width="20px"></td><td><code><span class="label">id</span>:String</code> &mdash; Ignored.
</td></tr></table></p></div><a name="isRealValue()"></a><a name="isRealValue(Object)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">isRealValue</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code> protected function isRealValue(value:Object):Boolean</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Returns <code>true</code> if <code>value</code> is not null.
</p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">value</span>:Object</code> &mdash; The value to test.
</td></tr></table></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code>Boolean</code> &mdash; <code>true</code> if <code>value</code> is not null.
</td></tr></table></div><a name="removeListenerHandler()"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">removeListenerHandler</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code> protected function removeListenerHandler():void</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Disconnects all of the listeners for the
<code>valid</code> and <code>invalid</code>
events dispatched from the validator. Subclasses should first call the
<code>removeListenerHandler()</code> method and then the
<code>addListenerHandler</code> method if
the value of one of their listeners or sources changes.
The CreditCardValidator and DateValidator classes use this function internally.
</p></div><a name="resourcesChanged()"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">resourcesChanged</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code> protected function resourcesChanged():void</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
This method is called when a Validator is constructed,
and again whenever the ResourceManager dispatches
a <code>"change"</code> Event to indicate
that the localized resources have changed in some way.
<p>This event will be dispatched when you set the ResourceManager's
<code>localeChain</code> property, when a resource module
has finished loading, and when you call the ResourceManager's
<code>update()</code> method.</p>
<p>Subclasses should override this method and, after calling
<code>super.resourcesChanged()</code>, do whatever is appropriate
in response to having new resource values.</p>
</p></div><a name="validate()"></a><a name="validate(Object,Boolean)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">validate</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code> public function validate(value:Object = null, suppressEvents:Boolean = false):<a href="../../mx/events/ValidationResultEvent.html">ValidationResultEvent</a></code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Performs validation and optionally notifies
the listeners of the result.
</p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">value</span>:Object</code> (default = <code>null</code>)<code></code> &mdash; Optional value to validate.
If null, then the validator uses the <code>source</code> and
<code>property</code> properties to determine the value.
If you specify this argument, you should also set the
<code>listener</code> property to specify the target component
for any validation error messages.
</td></tr><tr><td class="paramSpacer">&nbsp;</td></tr><tr><td width="20px"></td><td><code><span class="label">suppressEvents</span>:Boolean</code> (default = <code>false</code>)<code></code> &mdash; If <code>false</code>, then after validation,
the validator will notify the listener of the result.
</td></tr></table></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code><a href="../../mx/events/ValidationResultEvent.html">ValidationResultEvent</a></code> &mdash; A ValidationResultEvent object
containing the results of the validation.
For a successful validation, the
<code>ValidationResultEvent.results</code> Array property is empty.
For a validation failure, the
<code>ValidationResultEvent.results</code> Array property contains
one ValidationResult object for each field checked by the validator,
both for fields that failed the validation and for fields that passed.
Examine the <code>ValidationResult.isError</code>
property to determine if the field passed or failed the validation.
</td></tr></table><p><span class="label">See also</span></p><div class="seeAlso"><a href="../../mx/events/ValidationResultEvent.html" target="">mx.events.ValidationResultEvent</a><br/><a href="ValidationResult.html" target="">mx.validators.ValidationResult</a></div></div><a name="validateAll()"></a><a name="validateAll(Array)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">validateAll</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code> public static function validateAll(validators:Array):Array</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Invokes all the validators in the <code>validators</code> Array.
Returns an Array containing one ValidationResultEvent object
for each validator that failed.
Returns an empty Array if all validators succeed.
</p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">validators</span>:Array</code> &mdash; An Array containing the Validator objects to execute.
</td></tr></table></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code>Array</code> &mdash; Array of ValidationResultEvent objects, where the Array
contains one ValidationResultEvent object for each validator
that failed.
The Array is empty if all validators succeed.
</td></tr></table></div><div class="detailSectionHeader"> Event Detail </div><a name="event:invalid"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">invalid</td><td class="detailHeaderType"> Event </td></tr></table><div class="detailBody"><span class="label">Event Object Type: </span><a href="../../mx/events/ValidationResultEvent.html"><code>mx.events.ValidationResultEvent</code></a><br/><span class="label">ValidationResultEvent.type property = </span><a href="../../mx/events/ValidationResultEvent.html#INVALID"><code>mx.events.ValidationResultEvent.INVALID</code></a><br/><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Dispatched when validation fails.
</p>
The <code>ValidationResultEvent.INVALID</code> constant defines the value of the
<code>type</code> property of the event object for an <code>invalid</code> event.
The value of this constant is "invalid".
<p>The properties of the event object have the following values:</p>
<table class="innertable" ><tr><th>Property</th><th>Value</th></tr><tr><td><code>bubbles</code></td><td>false</td></tr><tr><td><code>cancelable</code></td><td>false</td></tr><tr><td><code>currentTarget</code></td><td>The Object that defines the
event listener that handles the event. For example, if you use
<code>myButton.addEventListener()</code> to register an event listener,
myButton is the value of the <code>currentTarget</code>. </td></tr><tr><td><code>field</code></td><td>The name of the field that failed validation.</td></tr><tr><td><code>message</code></td><td>A single string that contains
every error message from all of the ValidationResult objects in the results Array.</td></tr><tr><td><code>results</code></td><td>An array of ValidationResult objects,
one per validated field.</td></tr><tr><td><code>target</code></td><td>The Object that dispatched the event;
it is not always the Object listening for the event.
Use the <code>currentTarget</code> property to always access the
Object listening for the event.</td></tr></table>
</div><a name="event:valid"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">valid</td><td class="detailHeaderType"> Event </td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><span class="label">Event Object Type: </span><a href="../../mx/events/ValidationResultEvent.html"><code>mx.events.ValidationResultEvent</code></a><br/><span class="label">ValidationResultEvent.type property = </span><a href="../../mx/events/ValidationResultEvent.html#VALID"><code>mx.events.ValidationResultEvent.VALID</code></a><br/><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
Dispatched when validation succeeds.
</p>
The <code>ValidationResultEvent.VALID</code> constant defines the value of the
<code>type</code> property of the event object for a <code>valid</code>event.
The value of this constant is "valid".
<p>The properties of the event object have the following values:</p>
<table class="innertable" ><tr><th>Property</th><th>Value</th></tr><tr><td><code>bubbles</code></td><td>false</td></tr><tr><td><code>cancelable</code></td><td>false</td></tr><tr><td><code>currentTarget</code></td><td>The Object that defines the
event listener that handles the event. For example, if you use
<code>myButton.addEventListener()</code> to register an event listener,
myButton is the value of the <code>currentTarget</code>. </td></tr><tr><td><code>field</code></td><td>An empty String.</td></tr><tr><td><code>message</code></td><td>An empty String.</td></tr><tr><td><code>results</code></td><td>An empty Array.</td></tr><tr><td><code>target</code></td><td>The Object that dispatched the event;
it is not always the Object listening for the event.
Use the <code>currentTarget</code> property to always access the
Object listening for the event.</td></tr></table>
</div><div class="detailSectionHeader">Constant Detail</div><a name="constantDetail"></a><a name="DECIMAL_DIGITS"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">DECIMAL_DIGITS</td><td class="detailHeaderType">Constant</td></tr></table><div class="detailBody"><code>protected static const DECIMAL_DIGITS:String = 0123456789</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
A String containing the decimal digits 0 through 9.
</p></div><a name="constantDetail"></a><a name="ROMAN_LETTERS"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">ROMAN_LETTERS</td><td class="detailHeaderType">Constant</td><td class="detailHeaderRule">&nbsp;</td></tr></table><div class="detailBody"><code>protected static const ROMAN_LETTERS:String = ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version :&nbsp;</b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version :&nbsp;</b></td><td>Flex 3</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions :&nbsp;</b></td><td>Flash Player 9, AIR 1.1</td></tr></table><p></p><p></p><p>
A string containing the upper- and lower-case letters
of the Roman alphabet ("A" through "Z" and "a" through "z").
</p></div><a name="includeExamplesSummary"></a><div class="detailSectionHeader">Examples</div><div class="exampleHeader">SimpleValidatorExample.mxml</div><div class="detailBody"><div class="listing"><pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--&gt;
&lt;!-- Simple example to demonstrate the Validator class. --&gt;
&lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"&gt;
&lt;fx:Script&gt;
&lt;![CDATA[
// Import necessary classes.
import mx.controls.Alert;
import mx.events.ValidationResultEvent;
// Event listener for the valid and invalid events.
private function handleValid(evt:ValidationResultEvent):void {
if (evt.type == ValidationResultEvent.VALID) {
// Enable Submit button.
submitButton.enabled = true;
} else {
submitButton.enabled = false;
}
}
// Submit form is everything is valid.
private function submitForm():void {
Alert.show("Form Submitted!");
}
]]&gt;
&lt;/fx:Script&gt;
&lt;fx:Declarations&gt;
&lt;!-- The Validator class defines the required property and the validator events
used by all validator subclasses. --&gt;
&lt;mx:Validator id="reqValid" required="true"
source="{fname}" property="text"
valid="handleValid(event)"
invalid="handleValid(event);" /&gt;
&lt;/fx:Declarations&gt;
&lt;s:Panel title="Validator Example"
width="75%" height="75%"
horizontalCenter="0" verticalCenter="0"&gt;
&lt;mx:Form left="10" right="10" top="10" bottom="10"&gt;
&lt;mx:FormItem&gt;
&lt;mx:Text width="100%" color="blue"
text="Enter a value in the Name field before you can submit. The E-mail field is optional."/&gt;
&lt;/mx:FormItem&gt;
&lt;mx:FormItem label="Name: " required="true"&gt;
&lt;mx:TextInput id="fname" width="100%"/&gt;
&lt;/mx:FormItem&gt;
&lt;mx:FormItem label="E-mail address: " required="false"&gt;
&lt;mx:TextInput id="email" width="100%"/&gt;
&lt;/mx:FormItem&gt;
&lt;mx:FormItem&gt;
&lt;mx:Button id="submitButton" enabled="false"
label="Submit" click="submitForm();"/&gt;
&lt;/mx:FormItem&gt;
&lt;/mx:Form&gt;
&lt;/s:Panel&gt;
&lt;/s:Application&gt;
</pre></div><script language="javascript" type="text/javascript"><!-- AC_FL_RunContent( "src", "examples/SimpleValidatorExample", "width", "100%",
"height","400px", "salign", "TL", "id", "example1", "quality", "high", "bgcolor", "", "name",
"example1", "flashvars","", "allowScriptAccess","sameDomain", "type",
"application/x-shockwave-flash","pluginspage", "http://www.macromedia.com/go/getflashplayer" ); --></script></div><br/><br/><hr><br/><p></p><center class="copyright"><footer>The Apache Software Foundation</footer><br/>Wed Nov 15 2017, 09:50 AM +01:00 </center></div></body></html><!--The Apache Software Foundation<br/>Wed Nov 15 2017, 09:50 AM +01:00 -->