小编use*_*643的帖子

adobe flex用户输入必须包含"/"字符

在我的项目中,我有一个用户输入,前4个字符应该是数字,第五个字符必须是/,有没有办法控制它?

我正在使用Adobe Flash Builder 4.6.我只知道使用限制数字输入.

编辑1:在遵循Timofei的解决方案之后,我修改了我的源代码如下,但它没有生效,只通知用户"此字段是必需的".无论我在文本框中输入什么,没有任何警告,我的代码是否有问题?

<?xml version="1.0" encoding="utf-8"?>
<viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               xmlns:viewer="com.esri.viewer.*"
               right="450" bottom="175" width="320" height="450" widgetConfigLoaded="init()">
<fx:Script>
    <![CDATA[                       
        import mx.controls.Alert;       
        import spark.events.IndexChangeEvent;
        import flash.events.MouseEvent;
        import flash.events.Event;
        import mx.managers.PopUpManager;            

        public function handleEvent():void
        {
            mx.controls.Alert.show("bq no input: " + attr_bqNo.text)    
        }                                   
    ]]>
</fx:Script>
<fx:Declarations>
    <mx:RegExpValidator id="validator" expression="^\d\{4\}/" noMatchError="Error text here" source="{attr_bqNo}" property="text" 
                        trigger="{attr_bqNo}" triggerEvent="change"/>
</fx:Declarations>
    <s:TextInput id="attr_bqNo" x="41" y="29" width="212"/>


<viewer:WidgetTemplate id="attributesearch"
                       width="320" height="450">
    <viewer:layout>
        <s:BasicLayout/>
    </viewer:layout>
    <s:Label x="41" y="15" width="132" height="15" text="BQ No."/>      
    <s:Label x="40" …
Run Code Online (Sandbox Code Playgroud)

apache-flex input special-characters

0
推荐指数
1
解决办法
78
查看次数

标签 统计

apache-flex ×1

input ×1

special-characters ×1