[Zope] please wait page

Thomas B. Passin tpassin@mitretek.org
Wed, 17 Jul 2002 18:24:41 -0400


I have handled this situation by using frames and javascript.  The form for
the query is in one frame, and there is another frame to show the results of
the query.  I use the onClick method of the submit button to call a
javascript function.

The function first writes your "please wait"  message to the second frame
using document.write() (make sure to call document.close() when the message
has been written).  Next the function submits the form, whose target has to
be (of course) the second frame.  When the results come back from the
server, they appear in the second frame.

The code would look something like this:

function write_message_and_submit_form(){
    parent['result_frame'].document.write('Please Wait...');
    parent['result_frame'].document.close()
    document.form1.submit()
}

This works well.  Of course, if you do not like frames or javascript, it is
not for you.

Cheers,

Tom P

[Dieter Maurer]
> Alejandro Fernandez writes:
>  > I'd like to do a page to show to users while something loads. It would
>  > show users what queries have been executed from a database as they are
>  > executed. If the whole thing works, they then go to the page where they
>  > are shown the results of those queries.
>  >
>  > I'm doing this with dtml-calls to queries, which if working will say
>  > "query executed".
>  >
>  > But the page I've made to do this doesn't show this info - it only
loads
>  > once everything is done.
> HTTP is a very simple protocol. For each request, you get a single
> reponse, i.e. one page.
>
> You can force Zope to send the response and then continue work.
> You would use the "RESPONSE.write" method for this.
>
> There is a caveat with this:
>
>   You must either know the total size of the complete response
>   or you must use "Transfer-Encoding: chunked" and use
>   "chunked" encoding.
>
>   The first alternative means that the continued work may not
>   produce any output.
>
>   The second alternative is only available for HTTP/1.1 clients.
>
>   You may try a "Connection: close" header and not send the
>   "Content-Length". I am not sure, whether this will
>   work, especially because "RESPONSE.write" will add
>   a "Content-Length" when it is not specified.
>
> An alternative is to send a complete response (with "RESPONSE.write"),
> that uses the non-standard "refresh" meta tag (see a good HTML
> documentation) to automatically start a new request.
> The continued work must put its results somewhere, maybe in the
> session object. The new request will look there and show
> the results or refreshes itself again.