Use FormItem to wrap Button, TextInput
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
private function processValues():void {
var inputZip:String = zipCode.text;
var inputPhone:String = phoneNumber.text;
}
</mx:Script>
<mx:ZipCodeValidator id="zcVal" source="{zipCode}" property="text" domain="US or Canada" />
<mx:PhoneNumberValidator id="pnVal" source="{phoneNumber}" property="text" />
<mx:Form id="myForm" defaultButton="{mySubmitButton}">
<mx:FormItem label="Zip Code">
<mx:TextInput id="zipCode" />
</mx:FormItem>
<mx:FormItem label="Phone Number">
<mx:TextInput id="phoneNumber" />
</mx:FormItem>
<mx:FormItem>
<mx:Button label="Submit" id="mySubmitButton" click="processValues();" />
</mx:FormItem>
</mx:Form>
</mx:Application>
Related examples in the same category