Example: Creating A Simple Validator - Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual

Creating and extending flex 2 components
Hide thumbs Also See for FLEX 2 - CREATING AND EXTENDING COMPONENTS:
Table of Contents

Advertisement

A String that specifies the name of the subfield associated with the
subField
ValidationResult object.
In your override of the
method, you can define an empty Array and
doValidation()
populate it with ValidationResult objects as your validator encounters errors.
About the validate() method
You use the
method to programmatically invoke a validator from
Validator.validate()
within a Flex application. However, you should never override this method in your custom
validator classes. You need to override only the
method.
doValidation()

Example: Creating a simple validator

You can use the
StringValidator
class to validate that a string is longer than a minimum length
and shorter than a maximum length, but you cannot use it to validate the contents of a string.
This example creates a simple validator class that determines if a person is more than 18 years
old based on their year of birth.
Example: Creating a simple validator
219

Advertisement

Table of Contents
loading

Table of Contents