ricardo.poblete

Adobe Flex, ActionScript 3, etc…

Restrict characters into a TextInput

Posted by ripoblet on June 11, 2008

You must use restrict property if you don’t want the user put a special char, like spaces, ‘, <,>, etc.

If you want restrict the space you must use <mx:TextInput id=”txtInput” restrict=”^ ” />

If you want restrict single quote you must use <mx:TextInput id=”txtInput” restrict=”^’” />

If you want restrict double quote you must use <mx:TextInput id=”txtInput” restrict=”^\”" />

If you want restrict single and double quote you must use <mx:TextInput id=”txtInput” restrict=”^’\”" />

If you want restrict < or > you must use <mx:TextInput id=”txtInput” restrict=”^<>” />

 

Summary

If you want restrict some character you must use the restrict property and put into all characters that you don’t want user put into the text, but always beginnig with a ^ character.

 

Regards

 

ripoblet

 

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>