Search

Custom Search
03
Dec
08

Flex Using Data Binding to Configure Validators

User input might also define the properties of the validator. In the following example, you let the user set the minimum and maximum values of a NumberValidator:

Code Samples:

<?xml version="1.0"?>

<!-- validators\ConfigWithBinding.mxml -->

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:NumberValidator source="{inputA}" property="text" minValue="{Number(inputMin.text)}"

maxValue="{Number(inputMax.text)}"/>

<mx:TextInput id="inputA"/>

<mx:TextInput id="inputMin" text="1"/>

<mx:TextInput id="inputMax" text="10"/>

</mx:Application>

In this example, you use data binding to configure the properties of the validators. 

Care to share this story?

Get Adobe Flash playerPlugin by wpburn.com wordpress themes