Mark,
        First you need to understand how HTTP works:  It is
a stateless protocol, and it works in a
"request-response" cycle.  The "stateless" part means
that it doesn't retain any information about any
previous requests or responses, and that every
request is treated as a completely new one.  The
second part means that when the client sends a
request, the browser returns a response.
        When you use a browser as a client, a "request" is
any URL you enter in the address bar or hyperlink you
click on, which is sent to the server; and this
causes a "response" from the server, which, depending
on the type of resource it returns, is treated in a
specific way.  For instance, an HTML resource is
rendered as a web page, and a JPEG resource is
rendered as an image.

        Every request expects a response, this is the way
the protocol was designed, so there is no clear way
to say to the server "Do this and then don't give me
anything back".  But then whatever the server gives
back to the browser, the browser will try to
interpret it as best as it can -- even if you make
the server return an empty resource, the browser will
just display an empty web page.  This is clearly not
what you want.

        For this reason what is typically done is that when
a page requests some processing from the server that
should "return nothing" or "cause no change", the
server returns the original content so that the
browser can render it equally as if nothing happened.
 That's what I was showing how to do.  This is a
typical "state-machine" type of application, where
depending on the "state" of the application (either
first request, or form post), the server does
something different.

        An alternative is to not use the browser directly to
perform the request for processing, but to use
JavaScript, as Francois suggested.  This way,
whatever the server responds -- and it will *always*
respond with something -- you can throw it away or
interpret it as you want (using JavaScript).

        The point is that in order for the browser to stop
"waiting", the server has to respond with something
-- *anything* (even an empty response body, just the
headers); and whatever it responds with, the browser
will try to act upon it.  A web application is not
the same as a Win32 application.

        dZ.


zayin wrote:
> Hi,
> 
> Thanks for the information. 
> 
> What I am looking to do is just stop the client
browser from waiting. I do
> not want to change the page. 
> 
> In the two environments I am testing in, at
present, IE and Mozilla, after
> the user presses the "accept" button the browser
waits for a reply. With IE
> the tabsheet title shows a spinning circle. With
Mozilla it sets the cursor
> to the pointer+hourglass.
> 
> After the HandlePostedData I do not know what to
send to handle the client
> so the client stop this "wait" mode.
> 
> Ciao,
> 
> Mark
> 
>  
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
> Behalf Of [EMAIL PROTECTED]
> Sent: Monday, April 14, 2008 10:54 AM
> To: twsocket@elists.org
> Subject: Re: [twsocket] Post command...
> 
> Mark,
>       If what you want is to let the user know that
processing has
> completed, what you need to do is quite simple, old
school CGI processing:
> You change the rendered output to reflect the
results of processing.
> 
>       After finishing processing, change a variable,
say, "resultString",
> and display it in the rendered output.  You can
have something like:
> 
> // Notice the call to GetResultString() to inject
server output.
>  AnswerString(Flags,
>   '',           { Default Status '200 OK'         }
>   '',           { Default Content-Type: text/html }
>   '',           { Default header                  }
>   '<HTML>' +
>    '<HEAD>' +
>     '<TITLE>' + TitleString + '</TITLE>' +
>    '</HEAD>' +
>    '<BODY style="background:' + serverHTMLBGColor +
'">' +
>    GetResultString(resultString) +
>    '<form action="AC" method="post">' +      
> //accept command action
>     '<p>Tag:' + tagName + ' ' + cBackButton + '</p>' +
>     '<p>High Limit: ' + highEU + '</p>' +
>     '<p>Low Limit: ' + lowEU + '</p>' +
>     '<input name=Tagname type=hidden value="' +
tagname + '"/>' +
>     '<input name=ItemID type=hidden value="' +
itemIDString + '"/>' +
>     '<input name=UserValue type=text value="' +
currentValue + '"/><br/>' +
>     '<input name=AcceptBtn type=submit
> value="Accept"/>' +
>    '</form>' +
>   '</HTML>');
> 
> // -------
> 
> Function GetResultString(str: String): String Begin
>       If (str <> '') Then
>               Result := 'Server Responded: '+ str
>       Else
>               Result := '';
>       End If
> End;
> 
> // -- END
> 
> When the page is first rendered, the
> GetResultString() function will return an empty
string because the
> resultString hasn't been set.  And when the data is
posted and processed, it
> will display the new string.
> 
> This is pretty much how more complex and
sophisticated frameworks, like
> ASP.NET, Java-Struts, and PHP handle dynamically
generated pages.
> 
> What Francois was offering was a more "modern" and
popular approach, usually
> called AJAX, where your web page sends requests to
the server on a separate
> channel, using JavaScript, then parses the output,
and dynamically changes
> the document displayed.  It does the same thing
without "refreshing" the
> entire document.  However, as you stated, this may
not work in exactly the
> same way on every browser, and depends too much on
client-side processing,
> which is prone to errors and abuse.
> 
>       -dZ.
> 
> zayin wrote:
>> Hi,
>>
>> This all has to be done in HTML only.
>>
>> This is my first HTML programming task so, I do not
> know how to "make the
>> command from an invisible frame or layer".
>>
>> This is the page.
>>
>>  AnswerString(Flags,
>>   '',           { Default Status '200 OK'         }
>>   '',           { Default Content-Type: text/html }
>>   '',           { Default header                  }
>>   '<HTML>' +
>>    '<HEAD>' +
>>     '<TITLE>' + TitleString + '</TITLE>' +
>>    '</HEAD>' +
>>    '<BODY style="background:' + serverHTMLBGColor +
> '">' +
>>    '<form action="AC" method="post">' +      
> //accept command action
>>     '<p>Tag:' + tagName + ' ' + cBackButton + '</p>' +
>>     '<p>High Limit: ' + highEU + '</p>' +
>>     '<p>Low Limit: ' + lowEU + '</p>' +
>>     '<input name=Tagname type=hidden value="' +
> tagname + '"/>' +
>>     '<input name=ItemID type=hidden value="' +
> itemIDString + '"/>' +
>>     '<input name=UserValue type=text value="' +
> currentValue + '"/><br/>' +
>>     '<input name=AcceptBtn type=submit
> value="Accept"/>' +
>>    '</form>' +
>>   '</HTML>');
>>
>> Can you advise?



-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to