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

I need a alert box if the user does not save the page which he is in

Status
Not open for further replies.

kishore22

Technical User
Sep 25, 2002
12
US
Hi,
I have a page and some fields to input in by the user. The user has to save the page so has to retain his data when he comes back after browsing other pages.
If the user does not press the save button, and if he click the next/previous page link, then i should pop up a window saying that he should save the page, and it should not redirect to next/previous page.
If he clicks the save button, there should not be a pop up window if he clicks the previous/next page.

one thing,
when the user clicks the save button,it is redirected to other page where i am dumping the data into a access database.After dumping it is automatically redirected to the same page.

Help me with this guys


thanx
Kishore
 
Add <script>var saved=false</script> to the head.
Add onclick=&quot;window.saved=true&quot; to the save button.
Add onclick=&quot;return window.saved&quot; to the next/previous buttons. Adam
 
Oops, I should have read your question a little better. I thought the popup was saving the page.

Are you using ASP to save the page? If so, once the page is saved via a form handler page, redirect back to the form and add ?saved=1 to the end of the URL.
Response.Redirect &quot;myForm.asp?saved=1&quot;

Within the form, put
<script>
function alertSave(){
if('<%=Request(&quot;saved&quot;)%>'!='1'){
window.open('saveMe.htm','savePopup','width=400,height=300');
return false;
}
else{return true}
}
</script>
in the head.

And add onclick=&quot;return alertSave()&quot; to the next/previous buttons. Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top