首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

StringValidator 印证信息

2012-10-06 
StringValidator 验证信息?xml version1.0 encodingutf-8?!-- Simple example to demonstrate St

StringValidator 验证信息

<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate StringValidator. -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
????? xmlns:s="library://ns.adobe.com/flex/spark"
????? xmlns:mx="library://ns.adobe.com/flex/mx">
?
?<fx:Script>
??import mx.controls.Alert;
?</fx:Script>
?
?<fx:Declarations>
??<mx:StringValidator source="{fname}" property="text"
???????tooShortError="This string is shorter than the minimum allowed length of 4. "
???????tooLongError="This string is longer than the maximum allowed length of 20."
???????minLength="4" maxLength="20"?
???????trigger="{myButton}" triggerEvent="click"
???????valid="Alert.show('Validation Succeeded!');"
???????invalid="Alert.show('Validation Failed!');"/>
?</fx:Declarations>
?
?<s:Panel title="StringValidator Example"
??? width="75%" height="75%"
??? horizontalCenter="0" verticalCenter="0">
??<mx:Form left="10" right="10" top="10" bottom="10">
???<mx:FormItem label="Enter a name between 4 and 20 characters: ">
????<s:TextInput id="fname" width="100%"/>
???</mx:FormItem>
???<mx:FormItem >
????<s:Button id="myButton" label="Validate" />
???</mx:FormItem>
??</mx:Form>
?</s:Panel>
?
</s:Application>

热点排行