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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message to the user 1

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
0
0
US
Guys,

I have a page that takes a long time to load as it involves extensive SQL commands and has to read a lot of information from several tables from a poxy Btrieve DB.

Anyway, what I want to do is display a message to the user to have a bit of patience as it's going to take a while and I would like this message to disappear once the page loads. Does anyone have any suggestions on how to do this. i am open to either having it display on the main page ( maybe somehow using Response.Flush - which I am not familiar with ) or by having a pop-up window display the message.

Thanks in advance for the input. Mise Le Meas,

Mighty :)
 
one idea is to redirect to a page that says "please wait while loading....." and then automatically redirect to the page that takes a long time to load.

(but i forget if the "please wait while loading..." page will disappear once you do the 2nd redirect)

sorry..hope this helps though?

-Jas
 
Yea, I think this should work nicely --

Basically, instead of putting all the processing code above the head of the html document (that's how I normally do it) -- you could put it down in the body, but before that, you could render a table -- 1 row -- 1 column -- It will later become the title of the page, but will serve as a progress meter until processing finished --

Basically, put a span in the single cell of the table, and put a message in there about "Please wait while your results are processed" etc...

<td>
<span id=spanID>Please wait...</span>
</td>

Then, once the server script is finished loading, you can write some inline javascript to the screen that simply changes the contents of the span (not in a function, just right out to the document) --

ie.
<script language=javascript>
document.spanID.value = 'Now this is your title';
</script>

Or you could just wipe out the contents of the span altogether --

And then just go on about your business outputting results to the screen...

Did that make sense?
Paul Prewett
 
link9,

I'm not sure I get you. Is what you mean to do something like:

Response.Write &quot;<HTML>&quot;
Response.Write &quot;<BODY>&quot;
REsponse.Write &quot;<TABLE CODE WITH SPAN......>&quot;

..do all processing....

Continue writing the rest of the output code.

..

Is this what you mean and if so does the inline JS script just go in after all the processing is complete. Mise Le Meas,

Mighty :)
 
No, I mean like this...

<html>
<head>
<title>mypage</title>
</head>
<body>
<table>
<tr><td><span id=spanID>Please wait...</span></td></tr>
</table>
<%
'do your thing
'once your thing is done
with response
.write(&quot;<script language=javascript>&quot; & vbcr)
.write(&quot;document.spanID.value = &quot;'&quot;Now this is your title&quot;'&quot;;&quot;)
.write(&quot;</script>&quot;)
end with
%>

<!--the rest of your page-->

Yes, the inline javascript goes after all your processing is done, so that the value of the span doesn't change (ie - it keeps telling them to wait) until you are finished doing what you are doing.

You'll have to get those tick marks in the javascript up there, and I'm sure I did it the wrong way (never fails for me) -- but that's the gist of how you would go about it...

Is that any clearer?
Paul Prewett
 
link9,

Thanks.
I understand that but it presents me with a problem. I need to use the details that the user has submitted to generate a JS function that goes between the <HEAD></HEAD> tags. Therefore, i will have to do the processing before I can ouput this JS function. Does this mean that I won't be able to use your method?? Mise Le Meas,

Mighty :)
 
link9,

would it be possible to have the form page open a small window on submit and leave it on top. Then when the form input is completely processed and the output page produced, the new output page ( or the ASP page ) closes the pop up window.

Mise Le Meas,

Mighty :)
 
Mighty --

That sounds like a great idea --

Just have a page that is sitting there that just has a message in it about &quot;Please wait...&quot;

Open it up before you do anything else -- be sure to open it using a global variable (the inline stuff we've been talking about -- not in a function)

And then below where you do all your processing, just close the window -- yea, that would work nicely --

<script language=javascript>
var x;
x = window.open('wait.htm','waitWindow','width=300,height=150,scrollbars=no,toolbars=no');
</script>

<%
'do what you need to do
%>

<script language=javascript>
x.close();
</script>

I never even thought about that approach before. I think that's the one I'll use from now on if I need to display a waiting message.

Thanks! :)
 
Link9,

Thanks for the help. I have gone with the idea that I suggested to you at the finish. When my processing ASP page is loaded, the first thing I do is run the function that you showed above and the last thing that the ASP file executes is the JS inline function to close the window. Mise Le Meas,

Mighty :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top