10/7/2011 12:58:03 AM
Title:
Restrct Special characters in text input
Hi All,
I want to display the alert pop up, if the user enters only special characters in text input.
How to implement? Please help me.
Thanks & Regards,
krishna
10/12/2011 3:40:05 AM
you can use the following function in flex to check if there are any special characters entered in the textbox. Using regex it will show you alert that invalid characters are there in the textbox
//actionscript function
protected function textinput1_changeHandler(event:Event):void
{
// TODO Auto-generated method stub1
var validAlphaNumericRegExp:RegExp= /^[a-zA-Z0-9]*$/;
if(validAlphaNumericRegExp.test(mytext.text) == false){
Alert.show("Text box contain invalid characters");
};
}
// mxml
<mx:TextInput id="mytext" x="184" y="68" change="textinput1_changeHandler(event)"/>