<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
private function validateAddress():void{
var pattern:RegExp = new RegExp("\\d+\\x20[a-z]+", "i");
var result:int=billingAddress.text.search(pattern);
if (result == -1){
billingAddress.errorString = "Please enter a valid US address";
}else{
billingAddress.errorString="";
}
}
]]>
</mx:Script>
<mx:Form>
<mx:FormHeading label="Restaurant Delivery Information"/>
<mx:FormItem label="Name">
<mx:TextInput id="billingName"/>
</mx:FormItem>
<mx:FormItem label="Address">
<mx:TextArea id="billingAddress" width="160"/>
</mx:FormItem>
<mx:FormItem label="City">
<mx:TextInput id="billingCity"/>
</mx:FormItem>
<mx:FormItem label="State">
<mx:TextInput id="billingState" maxChars="2"/>
</mx:FormItem>
<mx:FormItem label="Zip">
<mx:TextInput id="billingZip"/>
</mx:FormItem>
<mx:FormItem>
<mx:Button label="Continue" click="validateAddress()"/>
</mx:FormItem>
</mx:Form>
</mx:Application>
Convert DATETIME TO TIMESPAN IN C#
13 years ago
No comments:
Post a Comment