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 5 2496 lu*****@gmail.com 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.setTimeout("refreshWindow()",100000);
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) lu*****@gmail.com 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.setInterval instead of window.setTimeout
Hey Jedi Fan,
You're a scholar & a saint!
Thanks for your help (Man, I feel like a newbie...)
Luke lu*****@gmail.com 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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.
...
|
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...
|
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...
|
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?
...
|
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...
|
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...
|
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,...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |