Forum Moderators: open

Message Too Old, No Replies

Submit form and set focus to a text field?

         

ling

7:22 pm on Jul 18, 2004 (gmt 0)

10+ Year Member



Hi!

Is there a way to do this:

While entering numbers in a textfield, my form is submitted. This is so that the numbers that i enter will be displayed on a text area beside it, as i entered it (in the same form).

I have tried onkeyup="form.submit(); focus()" to bring the focus back to the textfield. This didnt work. The form gets submitted but the textfield didnt get focus.
Is there a way to achieve this? or there's no way to do this? help!

RonPK

1:10 pm on Jul 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello ling, welcome to WebmasterWorld!

When a form is submitted, the current document will unload and the document returned by the server will be loaded by the browser. So it is useless to have any script after form.submit(); as it simply will not be executed.

Maybe you need to re-evaluate the logic in your script?

ling

2:43 pm on Jul 19, 2004 (gmt 0)

10+ Year Member



no wonder. ;)
Yes, I changed some of my code logic and managed without having to set focus after form submit.
Thanks!