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

response.redirect

Status
Not open for further replies.

lucyc

Programmer
Mar 1, 2002
62
US
I have 3 buttons on the button of the page. They ar e submit, Exit without Save and Reset button. On the Exit Without Save button, I have onclick="ExitWithOutSave()". If the user click on Exit without Save button, I want to alert the user, if he click yes, then I want to redirect him to another page, if no, then I want to stay on the same page that he is on. I am having problem on the response.redirect line. Here is my code:

<script language=&quot;vbscript&quot; >

Sub ExitWithOutSave()

Answer=MsgBox (&quot;You have selected to exit this page without saving the record . Are you sure you want to exit now?&quot;,52,&quot;Exit Without Save&quot;)

If Answer=6 then 'click Yes
response.redirect(&quot;default.asp&quot;)
else
history.go(-1) 'return to previous page
end if
End Sub

</script>

Please help. Thanks in advance.
 
add this condition to the msgbox
Dim MyVar
MyVar = MsgBox (&quot;Are you sure you want to exit without saving?&quot;, vbOKCancel)
if MyVar=1 then
exit sub
end if [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
wait a minute
you're in ASP land in your code
response methods don't work use
<script language=&quot;VBScript&quot;>
Location.href = &quot;URL&quot;
</script>
[bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
Hey onpnt,

It works. Thanks a lot.
 
glad to be of assistance
[thumbsup] [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top