mx.validators

# IValidatorListener - AS3 Flex

Package | mx.validators
Interface | public interface IValidatorListener
Implementors | UIComponent

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The interface that components implement to support the Flex data validation mechanism. The UIComponent class implements this interface. Therefore, any subclass of UIComponent also implements it.

Public Properties

| Property | Defined By
--- | --- | ---
|  | errorString : String The text that will be displayed by a component's error tip when a component is monitored by a Validator and validation fails. | IValidatorListener
|  | validationSubField : String Used by a validator to assign a subfield. | IValidatorListener

Public Methods

| Method | Defined By
--- | --- | ---
|  | validationResultHandler(event:ValidationResultEvent):void Handles both the valid and invalid events from a validator assigned to this component. | IValidatorListener

Property Detail

### errorString

property

`errorString:String`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The text that will be displayed by a component's error tip when a component is monitored by a Validator and validation fails.

You can use the `errorString` property to show a validation error for a component, without actually using a validator class. When you write a String value to the `errorString` property, Flex draws a red border around the component to indicate the validation error, and the String appears in a tooltip as the validation error message when you move the mouse over the component, just as if a validator detected a validation error.

To clear the validation error, write an empty String, "", to the `errorString` property.

Note that writing a value to the `errorString` property does not trigger the valid or invalid events; it only changes the border color and displays the validation error message.

Implementation
`public function get errorString():String`
`public function set errorString(value:String):void`

### validationSubField

property

`validationSubField:String`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Used by a validator to assign a subfield.

Implementation
`public function get validationSubField():String`
`public function set validationSubField(value:String):void`
Method Detail

### validationResultHandler

()
method

`public function validationResultHandler(event:ValidationResultEvent):void`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Handles both the `valid` and `invalid` events from a validator assigned to this component.

You typically handle the `valid` and `invalid` events dispatched by a validator by assigning event listeners to the validators. If you want to handle validation events directly in the component that is being validated, you can override this method to handle the `valid` and `invalid` events. From within your implementation, you can use the `dispatchEvent()` method to dispatch the `valid` and `invalid` events in the case where a validator is also listening for them.

Parameters

| `event:ValidationResultEvent` — The event object for the validation.

Related API Elements

mx.events.ValidationResultEvent

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00