Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page Synchronization

Status
Not open for further replies.

avarghese03

Programmer
May 14, 2004
6
US
Hi,

I have a jsp page where I load the results of a query from a database. Now that query takes time (about 30 secs). In the meantime, I want to display another page there with a message like "Please Wait..."

For eg., in the figure below, here's a page with three tabs: EMP, DEPT and CUST. So when user clicks on EMP, it shows employee information and clicking DEPT shows department information and so on... Now the tabs are Frame1 and the Page area is in Frame2.

Say the user has clicked on EMP and then would like to view CUST info. If the cust info query takes time, I want to display "please wait.." page. But when I do that in javascript, it does'nt work

------ -------- ---------
EMP | DEPT | CUST |
--------------------------------------------+
PAGE AREA |
________________________________|

My code (when the user clicks the tab) looks like this:

function tabClick(link,id)
{
parent.Frame2.location.href = 'Wait.html';
// the previous line does not work!!

var urlString = link+"?ID="+id;

if (urlString!="")
{
parent.Frame2.location.href = urlString;
}
}


Can anyone give me an idea of what I am doing wrong? I even tried to do a refresh but that causes more problems like it displays 'Wait.html' but it does not execute the subsequent commands!!!

function tabClick(link,id)
{
parent.Frame2.location.href = 'Wait.html';
parent.Frame2.location.refresh();

var urlString = link+"?ID="+id;

if (urlString!="")
{
parent.Frame2.location.href = urlString;
}
}

Any help is appreciated.

Thanks,
Al
 
Are you sure it's not working? You change it to a new location so quickly after that, it has no time to work.

Solutions might be to movie the "Please wait..." message to the window.status bar or have a THIRD frame displaying the "Please wait..." message until the data is loaded, at which time, the frames will resize to hide the "Please wait..." frame and show the data frame.

--Dave
 
Try giving the wait page a few seconds to load by setting a timeout on your cgi page.

Code:
function tabClick(link,id)
{
    parent.Frame2.location.href = 'Wait.html'; 
    parent.Frame2.location.refresh();

    var urlString = link+"?ID="+id;

    if (urlString!="") 
    { 
        setTimeout("parent.Frame2.location.href = urlString",2000);
    }
}

This will wait 2000 ms (2 secs) before it sends the 2nd page. Might work !!

ToddWW
 
Another option is to use the writeIn method to pass the Please Wait information directly to the window instead of loading an HTML page from your server. Combine this with the setTimeout method and you might be in luck.

ToddWW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top