# Form listener

**URL:** <https://forum.kirupa.com/t/form-listener/228339>\
**Category:** Uncategorized\
**Created:** [June 7, 2007, 12:39am UTC](https://forum.kirupa.com/t/form-listener/228339 "2007-06-07T00:39:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![puthem1st](https://avatars.discourse-cdn.com/v4/letter/p/ecb155/32.png) [@puthem1st](https://forum.kirupa.com/u/puthem1st)\
**Post date:** [June 7, 2007, 12:39am UTC](https://forum.kirupa.com/t/form-listener/228339/1 "2007-06-07T00:39:06Z")

</div>

Hi I have a basic form with several input boxes (first, last name, DOB, Place of birth, etc.) What I am trying to accomplish is have the user enter their answer in this order. If they try to enter in any other order than I want a restriction on the text box that will not allow them to enter until they have enter their answer and submitted at the right text box. Here is what I have tried…

The tab listeners and so forth work fine but my issue is detecting if they move the mouse character

```auto

var keyListener:Object = new Object();
keyListener.onKeyDown = function() { 
    if (Key.getCode() == Key.TAB) {
        Alert.show("You pressed the tab");
 }else {
  if (Key.getCode() ==Key.ENTER){
    Alert.show("You pressed the enter key");
      }else {
  if (Key.getCode() ==Key.SPACE){
  Alert.show("You pressed the space bar");
  }
 }
 }
};
Key.addListener(keyListener);

```

I used a mouse listener to detect if they tried to click outside the appropriate text box but this does nothing??

```auto

Key.addListener(keyListener);
/*var someListener:Object = new Object();
someListener.onMouseDown = function () { 
Alert.show("Nope", "You need to submit in the right box first");
Mouse.addListener(someListener);
};*/

```

Thank you
