# addListener conflicting with tabIndex

**URL:** https://forum.kirupa.com/t/addlistener-conflicting-with-tabindex/270413
**Category:** flash
**Created:** [September 9, 2008, 5:16pm UTC](https://forum.kirupa.com/t/addlistener-conflicting-with-tabindex/270413 "2008-09-09T17:16:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kyledefranco](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kyledefranco](https://forum.kirupa.com/u/kyledefranco)
#### Post date: [September 9, 2008, 5:16pm UTC](https://forum.kirupa.com/t/addlistener-conflicting-with-tabindex/270413/1 "2008-09-09T17:16:19Z")

</div>

Hello all.  
I’ve built a simple form. I set the tabindex accordingly, it worked fine.

But during testing some people suggested that I write a few replacements to automatically remove junk characters from the telephone field. I did so with an event listener (the code below). But once I put it in, the user has to tab twice to get their cursor to navigate from one textbox to another. I know this is the problem because when I take out the following code, the tabindexing works just fine (one click to navigate).

Is there a better way of doing this so I can avoid the “conflict”?  
Many thanks.

```auto
 
/* INITIALIZE AN EVENT LISTENER */
 var key_listener:Object=new Object();
 
/* ASSIGN THE EVENT LISTENER TO A FUNCTION */
 key_listener.onKeyDown=function() {
 
  /* MAKE SOME CHANGES */
   with(form_move_mc.form_mc) {
 
    /* MAKE SOME REPLACEMENTS */
     txt_telephone.txt.text=txt_telephone.txt.text.replace("-","");
     txt_telephone.txt.text=txt_telephone.txt.text.replace(".","");
     txt_telephone.txt.text=txt_telephone.txt.text.replace(" ","");
     txt_telephone.txt.text=txt_telephone.txt.text.replace("(","");
     txt_telephone.txt.text=txt_telephone.txt.text.replace(")","");
   }
 
 }
 
/* INSTANTIATE THE EVENT LISTENER */
 Key.addListener(key_listener);

```
