Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh once HELP

Status
Not open for further replies.

djabra31498

Programmer
Feb 24, 2004
7
US
I am trying to get a page to just refresh once when it first loads. How do I do this so that it forces it
 
You can set the value of a hidden field = 0 then change to 1 after the page is refreshed. I you don't do this, the page will keep refreshing every 3 seconds.
 
I've tried that, but it continually reloads the page. I only want it to reload once. Just the first time that the pages loads
 
Put this hidden field somehwre in the form.

<form name="form1" method="post" action="url">
<input type="hidden" value="0">
</form>

<%If Request.Form."FormCount" = 0 Then%>
<meta http-equiv="refresh" content="3">
<%End If%>
 
Oops! pls ignore my last post, it won't work. You to find a way to set a var to 0 and change it to 1 when the page is reloaded.
 
<%
<%
OnceThru = FALSE
IF request.form("flag") <> "" then
OnceThru = TRUE
End IF
%>
<html>
<head>
</head>
<body>
<form name="myForm" method="post">
<input type="hidden" name="flag" value="1">
</form>
</body>
</html>
<%IF NOT OnceThru Then%>
<script language="javascript">
document.forms[0].submit()
</script>
<%End IF%>


<%="Check the value of OnceThru --> " & OnceThru%>
 
Another option would be to do this completely server-side. At the bottom of your page you could check a session variable, then if it isn't set, set it and use Server.Transfer to transfer back tothe same file and execute it all again:
Code:
<%
'lots of code
'wheee
'more code

'bottom
If Session("reload_flag") <> "true" Then
   Session("reload_flag") = "true"
   Server.Transfer("thispage.asp")
Else
   'second load, clear the var just to be kind to the RAM
   Session.Remove("reload_flag")
End If

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top