Click to See Complete Forum and Search --> : Auto refresh a window


peter_hall
03-07-2003, 10:39 AM
Ive been trying to get one of my Intranet pages to automatically refresh itself when loaded. Im using a database connection to populate a text box and i need the data to be up-to-date every time the page is loaded.
Browsing away from the page and back to it with hyperlinks brings up a blank form but the database field is not updated.
Pressing F5 does the trick but i dont want the users to have to do this. Can a page reload itself (once!!), or can I stop the page being cached maybe?
Obviously i cant put history.go() into the onLoad event!!

Any help would be appreciated.

Peter

pyro
03-07-2003, 10:43 AM
When I want my pages to always be current, I use this bit of PHP code:

<?PHP
header("Expires: ".gmdate("D, d M Y H:i:s")." GMT"); // Always expired
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");// always modified
header("Cache-Control: no-cache, must-revalidate");// HTTP/1.1
header("Pragma: nocache");// HTTP/1.0
?>

peter_hall
03-07-2003, 10:57 AM
thanks for your reply..

not sure if im knowledgeable enough to get this right, but im using .asp pages and pasting that code into the body of the page didnt have any effect...

am i doing somehting wrong, or would i need to convert the page to a .php for it to work, and then would my asp bits work ok?

pyro
03-07-2003, 11:11 AM
Ah, nuts....No, PHP and ASP can't be combined, as far as I know...

Can ASP set headers? If so, I'd guess it would be quite easy to convert to ASP. I don't know any ASP, so, I don't know if it is possible...I bet is is, though.

Adding these to your <head> may work. I've never tried...Let me know...

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">

peter_hall
03-07-2003, 11:53 AM
Thanks loads, that seems to do the trick!

Page now loads with new info from the database, and no weird effects caused by reloading..

Much appreciated
Pete

pyro
03-07-2003, 12:12 PM
Good, glad to hear that it works... :D

Debra
03-14-2006, 08:55 AM
Directing this to Peter Hall on this response. I to am having problems reloading the new data in an asp form. First, I get the data from the dataset and load the form. They can then make changes to the data through a series of drop down selects. The first is selected which determines the content of the next dropdown and so on. I have tried everything and cannot get the form to load with the new select unless the page is refreshed manually. I would appreciate so much if you could advise.

Here is the script that does the on change event. I have tried several onload events but they refresh the page before the event finishes firing and the data does not load.


<SCRIPT LANGUAGE="VBScript" >
Function On_Combo_Change(Lstr_Control_Name)
'EditForm.Submit
window.document.forms("AddCorr").item("OnChangeEvent").value = Lstr_Control_Name.name
AddCorr.submit
'Msgbox(window.document.forms("AddCorr").item("SaveCorr").value)
'Msgbox(Lstr_Control_Name.name)
End Function
</SCRIPT>