# setFocus Problem

**URL:** <https://forum.kirupa.com/t/setfocus-problem/255926>\
**Category:** flash\
**Created:** [March 28, 2008, 11:20am UTC](https://forum.kirupa.com/t/setfocus-problem/255926 "2008-03-28T11:20:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pandu\_kirupa](https://avatars.discourse-cdn.com/v4/letter/p/cab0a1/32.png) [@pandu\_kirupa](https://forum.kirupa.com/u/pandu_kirupa)\
**Post date:** [March 28, 2008, 11:20am UTC](https://forum.kirupa.com/t/setfocus-problem/255926/1 "2008-03-28T11:20:10Z")

</div>

Hi all,

```
    I am having a login form in my application & am using SharedObject to store user details. Next time when the user opens the App, he doesn't need to type his user details. And the Login can be done pressing [COLOR=Red]Enter [COLOR=Black]key.[/COLOR][/COLOR]

```

[COLOR=Red]my problem is[/COLOR], lets assume the user details are already present (taken from SharedObject), When the User presses [COLOR=Red]Enter[/COLOR] key, it is jumping to next frame without any validation of the Script in the first frame.

If the user presses any of the TextField (Textfiled will get [COLOR=Red]Focus[/COLOR]), and presses [COLOR=Red]Enter [/COLOR]key, Its working fine.

I am using [COLOR=Red]Selection.setFocus(user\_txt)[/COLOR] to set the Focus, but it does nothing to solve the problem.

I tried this by making a sample file too, having 2 frames, first frame textfield, second frame  
sample text. [COLOR=Red][COLOR=Black]I used the same[/COLOR] Selection.setFocus(user\_txt) [COLOR=Black]method, but without pressing the TextField, if user presses [COLOR=Red]Enter [/COLOR]key, It is jumping to 2nd Frame without validation of the Script. Tried with [COLOR=Red]fscommand(‘trapallkeys’,false);[/COLOR], but in vain.

I want the User should not press the TextField.

so could somebody pls help me to solve this.

Sorry for a bit more explanation of my problem. I just want it to be clear for all.

Thnx  
pandu:)  
[/COLOR][/COLOR]
