"Asif Rahman" wrote in message
news:uK****************@TK2MSFTNGP14.phx.gbl...
: Please improve on the following code to make sure the record gets deleted
: only when the function returns false. Now I see the msgbox, but the record
: gets deleted no matter the user clicks yes or no.
:
: Thanks in advance.
:
: Asif
: =======================
: Code:
: <script language="VBScript">
: Function confirmDelete()
: answer = MsgBox("Are you sure you want to delete this one?",4,"Delete")
: If answer = 6 Then
: confirmDelete = true
: Else
: confirmDelete = false
: End If
: End Function
:
: </script>
:
: <%
: Response.Write "<a href=AprDelete.asp?ID=" & RS.Fields("ID") & "><img
: src=images/delete.gif border=0 onClick = 'ConfirmDelete()'></a>"
: %>
Where do you tell it to delete the record? All you're showing is a DHTML
onclick event to validate a question to delete or not but where is the
delete routine code? Hopefully this is on an Intranet since you're using
client-side vbscript and language= is deprecated. type="text/vbscript"
should be used. Since this is an ASP NG, it would help to see the server
side code.
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center -
http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library -
http://msdn.microsoft.com/library/default.asp