HTML/CSS Service

Flex Using the String Validator

Category: Flex Examples, flex tutorials    |    3,419 views

The StringValidator class validates that a string length is within a specified range. The following example ensures that a string is between 6 and 12 characters long:

Code Samples:

<?xml version=”1.0″?>
<!– validators\StringExample.mxml –>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml”>

<mx:Form id=”membershipForm”>
<mx:FormItem id=”fullNameItem” label=”Full Name”>
<!– Not validated –>
<mx:TextInput id=”fullNameInput”/>
</mx:FormItem>
<mx:FormItem id=”userNameItem” label=”Username”>
<mx:TextInput id=”userNameInput”/>
</mx:FormItem>
</mx:Form>

<mx:StringValidator source=”{userNameInput}” property=”text”
minLength=”6″ maxLength=”12″/>
</mx:Application>

Share/Save/Bookmark

1 Star2 Stars

Tags: ,

0 responses so far!

Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word