StringValidator for Form text input : StringValidator « Data Model « Flex






StringValidator for Form text input

StringValidator for Form text input
     

<!--
Code from Flex 4 Documentation "Using Adobe Flex 4".

This user guide is licensed for use under the terms of the Creative Commons Attribution 
Non-Commercial 3.0 License. 

This License allows users to copy, distribute, and transmit the user guide for noncommercial 
purposes only so long as 
  (1) proper attribution to Adobe is given as the owner of the user guide; and 
  (2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms. 
The best way to provide notice is to include the following link. 
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

-->



<!-- validators\StringExample.mxml -->
<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">
    <mx:Form id="membershipForm">
        <mx:FormItem id="fullNameItem" label="Full Name">
            <!-- Not validated -->
            <s:TextInput id="fullNameInput" />
        </mx:FormItem>
        <mx:FormItem id="userNameItem" label="Username">
            <s:TextInput id="userNameInput" />
        </mx:FormItem>
    </mx:Form>
    <fx:Declarations>
        <mx:StringValidator source="{userNameInput}"
            property="text" minLength="6" maxLength="12" />
    </fx:Declarations>
</s:Application>

   
    
    
    
    
  








Related examples in the same category

1.Using ActionScript to validate min length text inputUsing ActionScript to validate min length text input
2.Using StringValidator to check if the character count is within rangeUsing StringValidator to check if the character count is within range
3.Change event we can validate in real timeChange event we can validate in real time
4.Set StringValidator to validate required fieldSet StringValidator to validate required field
5.Using the StringValidator classUsing the StringValidator class
6.A StringValidator ensures text has been entered.A StringValidator ensures text has been entered.
7.Too long error and too short error messages for StringValidatorToo long error and too short error messages for StringValidator
8.Validating required fieldsValidating required fields