Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

Can I temporarily show one html page while some background process(asp program) is running on server side

      First  I  display one HTML page with input fields , where user  enters some  data and  presses submit button , which  in turn  calls an ASP program . This ASP program  processes data submitted  by user While it may take several seconds to process submitted data , I would want to display an HTML Page
With a Message : ? Your Request is being Processed ? Please Wait?.
After the Processing is finished?..The appropriate Processed ASP Page should be displayed?

How can I achieve this ? Please Explain ?
0
bapireddy
Asked:
bapireddy
  • 7
  • 5
  • 5
  • +8
1 Solution
 
Göran AnderssonCommented:
Try this:

<div id="msg">Your Request is being Processed. Please wait...</div>
<%
Response.Flush
' process here...
%>
<script language="javascript">
window.msg.innerHTML='';
</script>
0
 
santhoshgivesuanswersCommented:
hi, the problem above is that the operation is so fast that the message is hardly visible.
it is correct.
but if the process is fast the the message is hardly visible.
rgds
san
0
 
Göran AnderssonCommented:
Well, if the process is fast, then you don't have to see the message, right?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
dredgeCommented:
the easy way to do this required Windows 2000, and ASP 3.0



Please Wait While It's Being Processed.
<%
Server.Execute("/myfile.asp")
%>
0
 
Göran AnderssonCommented:
dredge, and that helps in what way?
0
 
dredgeCommented:
it helps by processing the file, while showing the current document on the screen.
0
 
Göran AnderssonCommented:
Not quite.

Try it.

Server.Execute only works as an include. Unless you have enough html before it to fill the buffer, nothing will be sent to the browser, until the processing is done.

You need a Response.Flush to make the message appear.

A Response.Buffer=False at the top also works, but only because then a Response.Flush is executed before every <%.
0
 
delu0007Commented:
Try this alternative.

Create a page that contains only your message in the body, but contains the following header:

<HEAD>
  <meta HTTP-EQUIV="refresh" CONTENT="2; URL=yourfile.asp>
</HEAD>

The URL yourfile.asp refers to the program you want to execute.

The entire page would be something like:

<HTML>
 <HEAD>
  <meta HTTP-EQUIV="refresh" CONTENT="2; URL=yourfile.asp>
 </HEAD>
  Your Request is being Processed.  Please Wait...
 <BODY>
</HTML>

You may need to attach the Request.Form object to the end of the URL.
 </BODY>
0
 
delu0007Commented:
The <BODY></BODY> tags are kind of messed up in my last post, but I think you can figure out what I meant.
0
 
mgfranzCommented:
This is silly delu0007.

You are still waiting for the page to process even after the "Refresh".

Sounds like you need a COM object...
0
 
delu0007Commented:
If I am reading the question right, bapireddy is trying to display one page while a separate page is processing.

The code I provided will do just that.  I am currently using this method and it executes as follows:

1) Browser displaying Selection.asp
2) User fills out form and submits
3) Browser immediately displays WaitMsg.asp and processes
Results.asp
4) Browser displays complete Results.asp

0
 
delu0007Commented:
If I am reading the question right, bapireddy is trying to display one page while a separate page is processing.

The code I provided will do just that.  I am currently using this method and it executes as follows:

1) Browser displaying Selection.asp
2) User fills out form and submits
3) Browser immediately displays WaitMsg.asp and processes
Results.asp
4) Browser displays complete Results.asp

0
 
mgfranzCommented:
Yeah?  show me...

Your code;

<HTML>
<HEAD>
 <meta HTTP-EQUIV="refresh" CONTENT="2; URL=yourfile.asp>
</HEAD>
 Your Request is being Processed.  Please Wait...
<BODY>
</HTML>


Does nothing except redirects the page to "yourfile.asp" after 2 seconds.  What's even worse is that there is no form processing or handling.  If you passed your form values to this, they would be gone as soon as the redirect takes place.
0
 
delu0007Commented:
As I mentioned, you would need to append the Request.Form object to the yourfile.asp URL in order to pass the form values along.

Your probably right in that it redirects after 2 seconds, but the WaitMsg page would remain displayed until the Results.asp is finished processing.

I'm very new to the internet programming area, but this is a method that I have found to work for the situation that bapireddy is describing.
0
 
mgfranzCommented:
Not to be pessimistic, but your example does not process results.asp at all, it ddoes nothing to the form contents or the page that needs them.  It does not "work".

You will need a VB COM that gets a value passed to it when results are ready.
0
 
delu0007Commented:
I don't know why it isn't working for you.  Perhaps my solution is browser dependent, or some other variable makes the difference -- but I know it works for me.

I'm not going to carry this debate any further.  I will wait and see if bapireddy responds to anything here before giving any more comments.
0
 
DeathwishCommented:
If all you want to do is show a message and then hide it and not use a component you can split the work up into two pages. Submit the form to the processing page. Then have something like below in the processing page:


<% Buffering.Buffer = true
<HTML>
<HEAD></HEAD>

<BODY>
Processing Request.....Please Wait....
<%
Response.Flush

.....rest of processing code here

Response.Redirect("finishedpage.asp")

%>

Basically they will see the message until the processing is done. Once done they will be redirected to a page that tells them all was done. If you did not want to do a seperate finish page, then you would have to use a component that would interact and send response back like mgfranz mentioned.
0
 
bapireddyAuthor Commented:


 Hi friends,

      i am very happy to a good response

 i felt DELU0007 answer is near to my question.it will work .  

DeathWish answer is not work , Becoz if we use RESPONS.FLUSH , fisrst it displays "Please wait ......"
message but after finishing background process , resulted
html will append to "please wait .........." message.

One more thing , if we use RESPONSE.REDIRECT , we are going to lost Form data.
0
 
mgfranzCommented:
You will also loose the form data if you use; <meta HTTP-EQUIV="refresh" CONTENT="2; URL=yourfile.asp>
0
 
Göran AnderssonCommented:
If you use my solution, you don't loose the form data.
0
 
AlfaNoMoreCommented:
posting page:
------------------------------------

<script language="JavaScript">
function validateForm(){
  //process your form here.
  for (i=0; i <= document.this_form.count; i++) {
    if (document.this_form.elements[i].value == "") {
      alert ("this form field is empty!!");
    }
  }
  //if no alerts then
  document.this_form.submit();
}
</script>

<form method="post" action="process.asp" name="this_form" onSubmit="window.open('please_wait.html','waiting','width=300,height=150,etc.');">
Put all your form fields in here.

If you want form validation, you could do this either using javascript right here (which would be easier).
<input type="button" name="submit" value="Submit" onClick="validateForm();">
</form>

process page:
------------------------------------

Put all your ASP in here to write the data to the db, or whatever you're doing. After the processing has happened, display this code.

<html>
  <head>
    <title></title>
    <script language="JavaScript">
    function CloseProgressWindow() {
      window.open('','waiting','');
      // if it's already open, it won't action this!
      waiting.close();
    }
    </script>
  </head>
  <body onLoad="CloseProgressWindow();">
  </body>
</html>

waiting page:
---------------------------------------

Just have this display a waiting message. It may not stay on for long, but if you want something to display for a fraction of a second, this is the way to do it. Most users will accept a slight delay while the next page is loading anyway!


Hope this is enough for you?

Daniel.
0
 
bapireddyAuthor Commented:
hi alfanomore,

    it will open a new window, i don't want open a new window. ofcourse  it is closed after background process is completed.

0
 
AlfaNoMoreCommented:
Most "users" will be quite happy with this! Think what they might want?

Daniel.
0
 
bapireddyAuthor Commented:
hi alfanomore,

    it will open a new window, i don't want open a new window. ofcourse  it is closed after background process is completed.

0
 
DeathwishCommented:
I don't think you are not going to get a perfect solution here. The window idea is what I have used before. Another I have used is this:

The process page -

<span id="Processing" style="position:absolute;top:90;left:expression((document.body.clientWidth / 2) - 225) ">
<center><TABLE><TR><TD width="450"><B><FONT COLOR="red" SIZE="+2">Loading Plan Provisions. Please Wait<span id="dots"></span></font></td></tr></table></span>
<script language="Javascript">
var intDotNum = 1
var DotTimer
LoadDots()

function LoadDots() {
     DotTimer = window.setInterval("DotProgress()",40)
}

function DotProgress() {
     var dots = ""
     var i = 0
     
     if (intDotNum == 6) {
          intDotNum = 1
     }
     else {
          intDotNum = intDotNum + 1
     }

     while (i < intDotNum) {
          dots = dots + "."
          i++
     }    
     document.all.dots.innerHTML = dots
}

</script>
<%

processing code here........................


%>
<script language="Javascript">
     var CtrlDots = document.all.Processing
     
     if (CtrlDots != null) {
          if (DotTimer != null) {
               window.clearInterval(DotTimer)
          }

          document.all.Processing.innerHTML = ""
     }
</script>

Buffering has to be set to false on the server for this to work. If it is off you would need to do a Response.Flush in the asp block. Also it has been tested only in IE. Not sure about Netscape here. Its similar to an idea GreenGhose had.
0
 
mgfranzCommented:
Yeah... there is no perfect solution other than writing a COM object.
0
 
Computer101Commented:
Hello experts.  Thoughts on closing this out? Delete, split?

Thank you
Computer101
Community Support Moderator
0
 
hongjunCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
[points to GreenGhost]

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

hongjun
EE Cleanup Volunteer
0
 
delu0007Commented:
Not to be greedy, but I think the response from the original question poster that was closest to accepting an answer was this one:

>Hi friends,
>
>     i am very happy to a good response
>
> i felt DELU0007 answer is near to my question.it will work .  
>
>DeathWish answer is not work , Becoz if we use RESPONS.FLUSH , fisrst it displays "Please wait ......"
>message but after finishing background process , resulted
>html will append to "please wait .........." message.
>
>One more thing , if we use RESPONSE.REDIRECT , we are going to lost Form data.

I think the original poster made it clear that he did not like GreenGhost's proposal.
0
 
PashaModCommented:
PAQ'ed and points not refunded,

PashaMod
Community Support Moderator @Experts Exchange
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 7
  • 5
  • 5
  • +8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now