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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with refresh

Status
Not open for further replies.

prog247

Programmer
Mar 16, 2001
17
0
0
US
People i got a little problem with refresh
when i sumit a form it goes on the next page
then i need to refresh the page.

<javascript>
location.reload()
</javascript>

and then i got some alert window and it says:

The page cannot be refreshed without resending the information.........

So is here some way to do not have the mesage?.
thanx.
 
If you want the page to load again without submitting the form, set the location object to the same url instead of calling the reload function.

<script>
self.location.href='myScript.cfm';
</script>

Good luck,
GJ
 
There is no way to prevent the message from appearing. If you want to use the javascript method, make sure you dont try to access any form variables on the action page. As long as the page you want to redirect to itself only retrieves variables from CF, the location URL, and the database you should be ok.

If you still need help tell us exactly why you need to refresh the page. Are you updating data that the page needs to be refreshed to view? There are other methods.
 
k her's more info i got a tree on the page and i'm using the javascript function to open a new window if new window is closed i refreshed the page but the problem is when the user is selecting an item in the tree then and then submit the form and then close the window the page cannot be refreshed without the alert window.

Thanx
 
Here is what I do.
I have a tree. When I do something in a window, I resubmit a form in the parent (the window with the tree)
I have in the parent a form like

<form name=&quot;main&quot; action=&quot;my_file.cfm&quot; method=&quot;post&quot;>
<!--- I store every parameter that this file needs in hiddens --->
<input type=&quot;hidden&quot; name=&quot;var1&quot; value=&quot;#var1#&quot;>
.........
</form>

before I close the window I use this script :
<script>
opener.document.main.submit()
</script>
this will resubmit the parent and will refreshe it.

Let me know if it isn't clear. I will try to be more explicit next time
 
What is the action on the form that you are using? If it's a post action, you will always get that message when reloading. If you change the action to get, the message will go away.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top