views:

30

answers:

0

when user clicks an asp button, the onClientClick calls a javascript function to open a popup. I am using IE8. User fills in some form data in the popup.

var mywin;
function popup(url)
{
  if (mywin==null || mywin.closed)
{
 mywin=window.open(url,--rest of parameters);
}
else
{
 mywin.focus();
}

mywin=window.open(url..) is called everytime the user clicks the asp button, even though the popup is never closed. I added an alert before the window.open and mywin.focus() to confirm what code is executed. the problem is the ASP Page_Load event for the popup url fires only once, the first time it is opened, and I use that event to fill in form data from session fields. The result is the user enters data in the popup, clicks outside the popup, the clicks the button again but the form data is blank. I could close the popup first, but the function always sees the popup window's state as null.