Validator, Model and Form controls
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Model id="infoVO">
<infoVOistration>
<email>{email.text}</email>
<phone>{phone.text}</phone>
<zip>{zip.text}</zip>
</infoVOistration>
</mx:Model>
<mx:EmailValidator source="{infoVO}" property="email" trigger="{submit}" triggerEvent="click" listener="{email}"/>
<mx:PhoneNumberValidator source="{infoVO}" property="phone" trigger="{submit}" triggerEvent="click" listener="{phone}"/>
<mx:ZipCodeValidator source="{infoVO}" property="zip" trigger="{submit}" triggerEvent="click" listener="{zip}"/>
<mx:Form>
<mx:FormItem label="Email" required="true">
<mx:TextInput id="email" width="200"/>
</mx:FormItem>
<mx:FormItem label="Phone" required="true">
<mx:TextInput id="phone" width="200"/>
</mx:FormItem>
<mx:FormItem label="Zip" required="true">
<mx:TextInput id="zip" width="60"/>
</mx:FormItem>
<mx:FormItem>
<mx:Button id="submit" label="Validate"/>
</mx:FormItem>
</mx:Form>
</mx:Application>
Related examples in the same category