# Restricting text input

**URL:** <https://forum.kirupa.com/t/restricting-text-input/254232>\
**Category:** flash\
**Created:** [March 10, 2008, 1:15am UTC](https://forum.kirupa.com/t/restricting-text-input/254232 "2008-03-10T01:15:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thurinus](https://avatars.discourse-cdn.com/v4/letter/t/db5fbb/32.png) [@Thurinus](https://forum.kirupa.com/u/Thurinus)\
**Post date:** [March 10, 2008, 1:15am UTC](https://forum.kirupa.com/t/restricting-text-input/254232/1 "2008-03-10T01:15:24Z")

</div>

Hey folks,

I’m trying to write an avatar chat application where i require the arrow and enter keys to perform special functions, so I’d like to restrict their input to the message textfield. I tried using the ‘restrict’ property of the textfield object, but that didn’t work.

This is basically what I want it to do:

When a user types any alphanumeric character/punctuations into the textfield, textfield acts normal. but when the Enter key or arrow keys are pushed, i do not want them to register into the textfield (this textfield is multi-line, so I don’t want the Enter key to give me a carriage return, or the arrow keys to move the typing cursor). I’ve tried many ways but can’t seem to manipulate the default behaviour of the textfield ☹ Anyone have any tips and ideas?

Thanks for any help!  
Jay
