aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Setting Focus after the form is Submitted Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Setting Focus after the form is Submitted" Watch "Setting Focus after the form is Submitted" New topic
Author

Setting Focus after the form is Submitted

m yasmin
Greenhorn

Joined: Nov 11, 2008
Posts: 9
Hello All,
I am trying to set the focus on an element after a form is submitted by doing the following:




I cant figure out why the focus is not getting set. However, it works if I remove the submit().

Thanks in advance.
Yasmin
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

The page goes away when the form is submitted, so there's nothing to set focus to!


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
stef li
Greenhorn

Joined: Jan 16, 2006
Posts: 27
you can do nothing any more after you submit the form.

if the system returns the same page after you submit the form, you can set a variable in your request scope.
and check the variable, if it exists then set the focus in the onload method. or do nothing.


This guy is so lazy!!!<br />There is nothing left!
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Do it during the onload or as an inline script of the result.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting Focus after the form is Submitted
 
Similar Threads
from is getting submitted when 'Refresh' button is clicked
form being submitted twice
form is getting submitted when 'Refresh' button on the browser is clicked.
jquery -- code review comparing original and current values on a form
The form Values are not getting set to the Backing bean