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.
/* 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);