• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting Focus after the form is Submitted

 
m yasmin
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The page goes away when the form is submitted, so there's nothing to set focus to!
 
stef li
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do it during the onload or as an inline script of the result.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic