• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

retain focus on child page while refreshing parent page

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have two jsps, one will be called from another.
On updating some info on the second jsp, the first jsp should be refreshed, but the focus should be retained on the child (2nd) jsp.

Any suggestions on this.

I wrote the following javascript code on the 2nd jsp.It is refreshing the parent(1st) jsp but the focus goes back to the parent jsp.I need the focus to be retained on the child jsp.For some reason self.focus() is not working in this case.

self.focus();
window.opener.location.reload(true);
self.focus();
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FYI: refreshing the parent is most likely going to kill the parent child relationship since refreshing tha page destroys the window object that created the pop up window. There is no way to avoid this other then using frames which is ewww (a mess to maintain).

Other then that to answer your question, try using a timeout that fires the code.
var timer = window.setTimeout("window.focus()",500);

Eric
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a similar problem, and was wondering if there was an elegant solution.

I process a form in a pop-up window using Ajax. I would like to fire a:



This obviously refreshes the parent window, and then closes the pop-up. In order to get this to work asynchronously, I fire these calls in my ajax_update_resp() callback function. It works in IE, but (shockingly) crashes my beloved Firefox.

If I do:


I am not guaranteed that the opener window will pick up the changes in time. I have thought about a small delay, but ouch -that is exact opposite effect I was looking for by using Ajax.

Any ideas, anyone?
reply
    Bookmark Topic Watch Topic
  • New Topic