473,569 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with screen update during event processing

Bob
Below is sample code that illustrates what I'm trying to do. For sake
of brevity I didn't include the properties of buildBtn that determine
what data to request.

The problem is I never see "Processing request" and depending on
server utilization the response can take several seconds to load
leading the users to wonder if the system is working. Unfortunately
getting rid of the users is not an option :) so any help I can get on
making this work is greatly appreciated.

TIA,
Bob

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script type="text/javascript">

// dynamically build button
function buildBtn(val){

function evt(){
results.innerHT ML = '<h2>Processin g request</h2>';

// Use for loop to simulate time it takes to
// get results page from server
for (var i=0; i<1500000; i++)
null;

// display results
results.innerHT ML = "<h2>" + btn.value + " results</h2>";
}

var btn = document.create Element('input' );
btn.type = "button";
btn.value = val;
btn.onclick = evt;
document.body.a ppendChild(btn) ;
}
</script>
</HEAD>

<BODY>
<script type="text/javascript">
var b1 = new buildBtn('butto n 1');
var b2 = new buildBtn('butto n 2');
</script>

<div id="results" />
</BODY>
</HTML>
Jul 20 '05 #1
4 5037
"Bob" <r.**********@a ttbi.com> wrote in message
news:5f******** *************** **@posting.goog le.com...
Below is sample code that illustrates what I'm trying to do. For sake
of brevity I didn't include the properties of buildBtn that determine
what data to request.

The problem is I never see "Processing request" and depending on
server utilization the response can take several seconds to load
leading the users to wonder if the system is working. Unfortunately
getting rid of the users is not an option :) so any help I can get on
making this work is greatly appreciated.

TIA,
Bob

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script type="text/javascript">

// dynamically build button
function buildBtn(val){

function evt(){
results.innerHT ML = '<h2>Processin g request</h2>';

// Use for loop to simulate time it takes to
// get results page from server
for (var i=0; i<1500000; i++)
null;

// display results
results.innerHT ML = "<h2>" + btn.value + " results</h2>";
}

var btn = document.create Element('input' );
btn.type = "button";
btn.value = val;
btn.onclick = evt;
document.body.a ppendChild(btn) ;
}
</script>
</HEAD>

<BODY>
<script type="text/javascript">
var b1 = new buildBtn('butto n 1');
var b2 = new buildBtn('butto n 2');
</script>

<div id="results" />
</BODY>
</HTML>

I don't know why it doesn't work but you could use:
window.status = "Processing request"
instead then set it to blank afterwards.
It also didn't work when I tried toggling the visibility of an animated gif
such as:
http://www.itn.net/gif/style/ua/loading.gif
using this HTML:

<span id="loading" style="visibili ty:hidden">
<img src="http://www.itn.net/gif/style/ua/loading.gif" border="0"
alt="Processing request">
</span>

and this javascript:
loading.style.v isibility = "visible";
and
loading.style.v isibility = "hidden";
a the beggining and end of the "evt()" function.
Jul 20 '05 #2
DU
Bob wrote:
Below is sample code that illustrates what I'm trying to do. For sake
of brevity I didn't include the properties of buildBtn that determine
what data to request.

The problem is I never see "Processing request" and depending on
server utilization the response can take several seconds to load
leading the users to wonder if the system is working. Unfortunately
getting rid of the users is not an option :) so any help I can get on
making this work is greatly appreciated.

TIA,
Bob

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script type="text/javascript">

// dynamically build button
function buildBtn(val){

function evt(){
results.innerHT ML = '<h2>Processin g request</h2>';

Written like that, only MSIE will be able to support this.
document.getEle mentById("resul ts").innerHTM L = "<h2>Proces sing
request</h2>";
will work on most W3C DOM 2 compliant browsers.

The 2nd problem is that the buildBtn is called as the document loads and
results is not seen in the program. You can not make a call about an
object which does not already exists. Here, the referenced object
"results" does not exist at the point where the 2 buildBtn functions are
called.
This is a scope problem. Just by using defer or an init function on the
load event of the body, you can avoid all this.

// Use for loop to simulate time it takes to
// get results page from server
for (var i=0; i<1500000; i++)
null;

This looks very very weird to me. You're deliberately occupying the cpu
with a bogus, pointless loop. This abuses user's system resources. Just
imagine what this will cause to users having different system resources.
// display results
results.innerHT ML = "<h2>" + btn.value + " results</h2>";
You're overwriting what was previously written. Is that intentional?

I personally would have used entirely compliant DOM methods to write
dynamically these results into the document and, of course, without the
weird and suspicious for loop.
}

var btn = document.create Element('input' );
btn.type = "button";
btn.value = val;
btn.onclick = evt;
evt is often used as the event object generated by an event listener in
W3C DOM 2 events; that's why I would use another identifier than evt.

document.body.a ppendChild(btn) ;
}
</script>
</HEAD>

<BODY>
<script type="text/javascript">
var b1 = new buildBtn('butto n 1');
var b2 = new buildBtn('butto n 2');
</script>

<div id="results" />
I'm pretty sure you can not minimize the div like that. I would be very
surprised if you can do that without problems.
</BODY>
</HTML>


DU
Jul 20 '05 #3
Bob
DU <dr*******@hotR EMOVETHISmail.c om> wrote in message news:<bt******* ***@news.eusc.i nter.net>...
Bob wrote:
Below is sample code that illustrates what I'm trying to do. For sake
of brevity I didn't include the properties of buildBtn that determine
what data to request.

The problem is I never see "Processing request" and depending on
server utilization the response can take several seconds to load
leading the users to wonder if the system is working. Unfortunately
getting rid of the users is not an option :) so any help I can get on
making this work is greatly appreciated.

TIA,
Bob

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script type="text/javascript">

// dynamically build button
function buildBtn(val){

function evt(){
results.innerHT ML = '<h2>Processin g request</h2>';

Written like that, only MSIE will be able to support this.
document.getEle mentById("resul ts").innerHTM L = "<h2>Proces sing
request</h2>";
will work on most W3C DOM 2 compliant browsers.


First off, thanks for taking the time to respond. This is an intranet
only page where the client configuration is restricted only to MSIE.

The 2nd problem is that the buildBtn is called as the document loads and
results is not seen in the program. You can not make a call about an
object which does not already exists. Here, the referenced object
"results" does not exist at the point where the 2 buildBtn functions are
called.
This is a scope problem. Just by using defer or an init function on the
load event of the body, you can avoid all this.

Two instances of buildBtn are instantiated when the form loads however
the contents of "results" are only modified as part of the onclick
event for each button so "results" does exist at the time it's
referenced.

// Use for loop to simulate time it takes to
// get results page from server
for (var i=0; i<1500000; i++)
null;


This looks very very weird to me. You're deliberately occupying the cpu
with a bogus, pointless loop. This abuses user's system resources. Just
imagine what this will cause to users having different system resources.


The loop was only put in as a time delay to demonstrate the issue. The
actual page sends form information to the server and retrieves the
results.
// display results
results.innerHT ML = "<h2>" + btn.value + " results</h2>";


You're overwriting what was previously written. Is that intentional?

I personally would have used entirely compliant DOM methods to write
dynamically these results into the document and, of course, without the
weird and suspicious for loop.


Yes, it is intentional, "results" is used to display dynamic data
based on user input
}

var btn = document.create Element('input' );
btn.type = "button";
btn.value = val;
btn.onclick = evt;


evt is often used as the event object generated by an event listener in
W3C DOM 2 events; that's why I would use another identifier than evt.


Thanks, I'll change it to something else.
document.body.a ppendChild(btn) ;
}
</script>
</HEAD>

<BODY>
<script type="text/javascript">
var b1 = new buildBtn('butto n 1');
var b2 = new buildBtn('butto n 2');
</script>

<div id="results" />


I'm pretty sure you can not minimize the div like that. I would be very
surprised if you can do that without problems.


I haven't had any problems so far but I'll keep this in mind should I
encounter any weirdness.
</BODY>
</HTML>


DU

Jul 20 '05 #4
Bob
"McKirahan" <Ne**@McKirahan .com> wrote in message news:<7NXLb.164 96$xy6.42580@at tbi_s02>...
"Bob" <r.**********@a ttbi.com> wrote in message
news:5f******** *************** **@posting.goog le.com...
Below is sample code that illustrates what I'm trying to do. For sake
of brevity I didn't include the properties of buildBtn that determine
what data to request.

The problem is I never see "Processing request" and depending on
server utilization the response can take several seconds to load
leading the users to wonder if the system is working. Unfortunately
getting rid of the users is not an option :) so any help I can get on
making this work is greatly appreciated.

TIA,
Bob

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script type="text/javascript">

// dynamically build button
function buildBtn(val){

function evt(){
results.innerHT ML = '<h2>Processin g request</h2>';

// Use for loop to simulate time it takes to
// get results page from server
for (var i=0; i<1500000; i++)
null;

// display results
results.innerHT ML = "<h2>" + btn.value + " results</h2>";
}

var btn = document.create Element('input' );
btn.type = "button";
btn.value = val;
btn.onclick = evt;
document.body.a ppendChild(btn) ;
}
</script>
</HEAD>

<BODY>
<script type="text/javascript">
var b1 = new buildBtn('butto n 1');
var b2 = new buildBtn('butto n 2');
</script>

<div id="results" />
</BODY>
</HTML>

I don't know why it doesn't work but you could use:
window.status = "Processing request"
instead then set it to blank afterwards.
It also didn't work when I tried toggling the visibility of an animated gif
such as:
http://www.itn.net/gif/style/ua/loading.gif
using this HTML:

<span id="loading" style="visibili ty:hidden">
<img src="http://www.itn.net/gif/style/ua/loading.gif" border="0"
alt="Processing request">
</span>

and this javascript:
loading.style.v isibility = "visible";
and
loading.style.v isibility = "hidden";
a the beggining and end of the "evt()" function.


Your response got me to thinking. I'm trying to update the screen in
the middle of handling an event which probably is the reason why it
doesn't work. What I really need to do is handle the event then
retrieve the info. So I tried splitting "evt" into two function and
using setTimeout to process the loadTbl function. The problem is I'm
not sure how to reference loadTbl.

If I move loadTbl outside of buildBtn it works but then I have other
issues to deal with so I'd rather not do that if I could avoid it. Any
ideas?

function evt(){
results.innerHT ML = '<h2>Processin g request</h2>';
setTimeout(load Tbl, 1); // This line produces an error
}

function loadTbl(){
// Use for loop to simulate time it takes to
// get results page from server
for (var i=0; i<1500000; i++)
null;

// display results
results.innerHT ML = "<h2>" + btn.value + " results</h2>";
}
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
6190
by: Victor | last post by:
I need a JavaScript timer - I have five events I need to time, that can be triggered by a mouseclick event, or a keypress event. Each event is separated by only one to two seconds. The first event (mouse or key) starts the timer. Then, each time the event (mouse or key) occurs, I need to display the present time in the corresponding spot on...
2
2921
by: Mike Button | last post by:
Hello all, I am really really desperate on what I should do, and I am asking for help from anyone in this newsgroup, here's the situation: I am creating a form that is being run on a server where there is no scripts allowed running (the software is from Opentext called Livelink)- therefore I need javascript to do the tasks listed below:...
11
1750
by: Glen Wolinsky | last post by:
This is my first attempt as asynchronous processing. I have created a small test app as proof of concept, but I am having one proglem. In the example (code listed below), my callback routine has two problems: 1. It runs TWICE; and 2. While it seems to update the web page controls, the results never show up on the page. I am using...
5
3117
by: Geoff Pennington | last post by:
My VB.Net app reads an Excel file, processes it one row at a time, and when processing is complete writes the row to a database. The typical file will have several thousand rows and may take a couple minutes to process. I would like to display a running count of the number of rows processed. It is easy enough to keep a counter and set the...
3
2629
by: aprivate | last post by:
Hi I am having some problem with a form timer. I added a progress bar to increment its value and the timer works when I use form1.showdialog() However when I use form1.show, form1.refresh() the timer does not fire even if I had explicitly set the timer1.enabled=true and timer1.start
11
30087
by: Hoku | last post by:
I am using dual monitors on a dual head ATI AGP4x video card. I installed the Nov 11 2005 release of ATI's catalyst control center with Hydravision to manage the dual monitor setup. I recently updated to .NET v2 and run Zone Alarm Internet Sec Suite 2006 for firewall and av. When I log off/shut down the computer a dialog box appears as...
9
13893
by: Jakob Lithner | last post by:
1) I have a DataGridView with edit capability. But in some columns I want to limit the input with a DropDownList. There is no inbuilt column for DropDownLists so I intended to add one myself. I thought the TemplateField would be a good candidate so I added a DropDownList in the EditItemTemplate and a Literal in the ItemTemplate, but then I...
2
5766
by: rdemyan via AccessMonster.com | last post by:
My application has a lot of complicated SQL statements, calculations, processing that takes time. I've created a custom form to act like a messagebox. It has 10 small rectangles on it that change color sequentially to let the user know that processing is occurring. This 'animation' occurs via the form timer event. However, I'm having...
46
2497
by: Bruce W. Darby | last post by:
This will be my very first VB.Net application and it's pretty simple. But I've got a snag in my syntax somewhere. Was hoping that someone could point me in the right direction. The history: My work involves creating custom packages of our software product for golf courses that purchase our software. The course data is kept as a back up in...
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.