Accessibility

Flex Components

Adobe Masked TextInput

By FlexExchangeAdmin November 27, 2006
7,750 Downloads

Rating = 421 votes


The Masked Text Input component is a single-line, text input field. This component adds support for the validation of input against a specified mask expression on a character by character basis. Updated for Flex 2.0.1 with following changes text and fullText properties are now made Bindable

SUPPORT INFORMATION
Informally supported by Adobe engineering. See the Flex Team blog post: http://weblogs.macromedia.com/flexteam/archives/2006/11/component_maske.cfm

Download

License: Freeware
Language:
Cost: Free
Platform: Flash Player 9
File format: ZIP | 544.8 KB

Additional extension information

Author: FlexExchangeAdmin
Author website: http://weblogs.macromedia.com/flexteam
Date published: November 27, 2006
Approval: None
Compatible product(s): Flex 2.0.1

Reviews

1-5 of 8 reviews | Show all reviews


Kevin K 21-Oct-09 Rating = 3

Update - the below fixes setting the text property but causes the cursor to advance improperly when typing. Use this instead:

//if first character is not a viable input position...
if(!isMask(maskMap[0][0]) && !(event is TextEvent))
{
advancePosition(); //advance to the first viable input position
}

Kevin K 20-Oct-09 Rating = 3

To fix the bug where the first character is cut when setting the text property, add the following code at the top of MaskedTextInput.handleInput() after the if(input == null) block:

//if first character is not a viable input position...
if(!isMask(maskMap[0][0]))
advancePosition(); //advance to the first viable input position
}

This bug occurs when the first position in the mask is not an input position. The above code advances to the first input position before entering the loop that enters characters.

Ravi Ganesh 06-Jan-09 Rating = 2

i am using this component for a displaying a phone number. But when i give a text like 123456789 it is showing 23456789 so the first character is getting cut.
Any ideas??

dnbonnell 25-Nov-08 Rating = 4

Thanks for a very useful control. Below are two minor fixes.

1. If text is set to null then it throws a NPR exception in handleInput. I fixed this by adding a check at the top of handleInput:

if ( input )
{
.... // the original code
}

2. A standard TextInput control dispatches a change event (Event.CHANGE) if the text property is changed through user input. MaskedTextInput does not. (Well, it does for deletions but not additions!). To fix this I added the following to the end of handleInput, right before the closing brace of the if block above.

if ( event )
dispatchEvent(new Event(Event.CHANGE));

dani4j 19-Mar-08 Rating = 3

I think there's a bug, or I don't know how to handle the problem.

If I enter a date (set text - not manually) if the first character is 0 is stripped out so 1st January for example instead of 01/01/2008 will be 10/12/008. Everything is moved left.

Is there some workaround ?

Thank you

Add a review

(+) Please log in to submit a review