473,657 Members | 2,521 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Refresh Page - Unless Condition

Hey Guys,

Hoping that you can help me, as I have been scratching my head and
getting nothing but dandruff...

SITUATION
---------
I have a webpage which users will be viewing, which has forms which can
be hidden or displayed at the user's choice. The problem is that they
want the page to refresh every X seconds, but if it refreshes when a
form is displayed, then the form loses the entered data and disappears
as the screen is redrawn, meaning the user has to write it all up
again.

MISSION
-------
I want to create a JavaScript refresh function, which will only refresh
the page if a certain condition is met. The condition will be a
variable which will count the number of forms currently being
displayed. If the variable ('openForms') is 0, then the refresh should
be executed.

ATTEMPTS THUSFAR
----------------
function refreshCounter( ) {
Id = setTimeout( refreshWindow() , 100000 );
}
function refreshWindow() {
if ( openForms==0 ) {
// No Windows Open - Reloading
window.location .reload(true);
} else {
// Windows Open - NO Reload
}
}

RESULT THUSFAR
--------------
The page was constantly trying to reload the second it opened - causing
a loop which only stopped when I commented out the second line of
"refreshCounter ()".

Any suggestions, or assistance would be appreciated.
Am I doing this the easiest possible way? Or is there a better option?

Thanks
Luke

Jul 26 '05 #1
5 2519
lu*****@gmail.c om wrote:
Hey Guys,

Hoping that you can help me, as I have been scratching my head and
getting nothing but dandruff...

SITUATION
---------
I have a webpage which users will be viewing, which has forms which can
be hidden or displayed at the user's choice. The problem is that they
want the page to refresh every X seconds, but if it refreshes when a
form is displayed, then the form loses the entered data and disappears
as the screen is redrawn, meaning the user has to write it all up
again.

MISSION
-------
I want to create a JavaScript refresh function, which will only refresh
the page if a certain condition is met. The condition will be a
variable which will count the number of forms currently being
displayed. If the variable ('openForms') is 0, then the refresh should
be executed.

ATTEMPTS THUSFAR
----------------
function refreshCounter( ) {
Id = setTimeout( refreshWindow() , 100000 );
}

<SNIP>
Id = setTimeout( refreshWindow() , 100000 );
should be
window.setTimeo ut("refreshWind ow()",100000);
Jul 26 '05 #2
Hi "Jedi Fans",

Thanks for your lightning quick response!!!!

Such a simple error and a messy result...
I have made the modification as suggested and, for the first run
through, it worked - I had a form open (so the condition would prevent
the refresh from happening) for the first cycle, and then I hid it (so
the condition would let the refresh happen) the second time, but it
looked like the loop ceased after the first run.

Any further suggestions on how I can achieve this?

Thanks
Luke
(Apprentice)

Jul 26 '05 #3
lu*****@gmail.c om wrote:
Hi "Jedi Fans",

Thanks for your lightning quick response!!!!

Such a simple error and a messy result...
I have made the modification as suggested and, for the first run
through, it worked - I had a form open (so the condition would prevent
the refresh from happening) for the first cycle, and then I hid it (so
the condition would let the refresh happen) the second time, but it
looked like the loop ceased after the first run.

Any further suggestions on how I can achieve this?

Thanks
Luke
(Apprentice)

window.setInter val instead of window.setTimeo ut
Jul 26 '05 #4
Hey Jedi Fan,

You're a scholar & a saint!

Thanks for your help (Man, I feel like a newbie...)
Luke

Jul 26 '05 #5
lu*****@gmail.c om wrote:
Hey Jedi Fan,

You're a scholar & a saint!

Thanks for your help (Man, I feel like a newbie...)
Luke

yvw Luke, also unless your email address doesnt mind being spammed...
best to munge it like this:
lucanos[at]gmailNOSPAM[dot]com or summin invalid so the spammers dont get it
Jul 26 '05 #6

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

Similar topics

6
2948
by: Rick | last post by:
Hi folks, I have a web page I wrote for a class assignment (which I embellished a little) that doesn't seem to work on all browsers, platforms, etc. The problem appears to be that the page doesn't refresh completely when the page calls it self. The refresh (which should happen when the form action fires) should reload a file into an iFrame, but it doesn't. I do have 3 submit buttons on one form, but it works well for me. On the...
10
6465
by: Conax | last post by:
Hi there, My boss is hoping that I can come up with a page that displays some information. The information will always be displayed on specific part of the page, with auto refresh. But he doesn't want the whole page to be refreshed so that buttons and images around the information do not get reloaded each time. Is this really possible? Other pages on this site don't use frames, so this page can't use frams too. Creating an ActiveX...
1
8367
by: SPQR | last post by:
Some time ago I set up a webcam at home and a page on my site. Every three minutes the webcam would take a picture of my backyard and ftp it to my site where it was displayed on my webcam page. The image was ftp'ed to ftp://mydomain.org/webcam.jpg. On my website was a file, webcam.htm, that had a place for the image, webcam.jpg. I put an HTML code on my webcam page that caused it to refresh every 3 minutes -- every 3 minutes, the...
2
2052
by: Mike | last post by:
oh my pages i have an option to allow user to refresh and a text box for them to enter in 10, 20 , 4 and i break it down to seconds. but then the page actaully refreshs the data is not refreshing so when the data in the database is updated the user is not seeing unless the close the browser down and go page to the page. Even F5 of the IE refresh button is not truly refreshing the page. how can i get the page to refresh and get the latest...
2
2718
by: Just D. | last post by:
All, How should we refresh the current aspx frame? I disabled caching using this command on Page_Load(): Response.Cache.SetCacheability(HttpCacheability.NoCache); but it didn't help. The problem is that this page shows the client Logo image, then asks to upload a new one if required, finally it should show the uploaded picture. The problem is that it doesn't. If I press F5, then I can see the updated
10
23410
by: Fred Nelson | last post by:
Hi: I have a VB.NET web application and I need to find a way to cause a page refresh from within my application. Does anyone know how to force the browser to refresh the current page? Thanks very much for your help! Fred
8
9397
by: Jason S | last post by:
Hi, is there any way of getting my VB (6.0) program to automatically 'Refresh' an IE window that might be active (window status not applicable). It needs to be able to determine which active IE window to refresh, based on its caption. For example, there is a web site that I want to keep active where I normally have to refresh it manually before it times out (every 15 min or so). I might be doing something else at the time so I don't...
1
2072
by: rockdale | last post by:
Hi, all I am coding a asp.net application as user data entry and report interface. We also have another C#.net appplication (a server) does some other stuff, my webserver can send and receive message with the C#.net server application. Now the C#.net server application group want me to refresh my webpage to show the real time status when I receive a message from them. I do not think I can do that (correct me if I am wrong). On webserver...
6
1831
by: Chris Beall | last post by:
(I'm rather inexperienced with JavaScript; the failing page was cobbled together from multiple sources)... http://pages.prodigy.net/chris_beall/STL/Timeline.html If JavaScript is not present, or CSS 2 isn't supported, the page just shows a complete list of dated entries. That's correct. If JavaScript is present and CSS 2 is supported, a subset of the list is shown (Example: 9 Jan 2008 is absent) and a button appears in the upper
0
8305
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
7320
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.