Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 773
  • Last Modified:

msgbox to confirm before delete

Have a asp/vbscript application where I need to have a client-side msgbox popup and confirm before a delete takes place.

If request.form("deletehospital"i) = "Delete Hospital" Then
     
   ---NEED A MSGBOX HERE WITH CONFIRMATION. IF 'OK' CLICKED THEN DO BELOW DELETE.---
   
   set conn=Server.CreateObject("ADODB.Connection")
   conn.Provider="Microsoft.Jet.OLEDB.4.0"
   conn.Open "d:/basedata/xxx.mdb"
   sql="DELETE FROM hospital"
   sql=sql & " WHERE id=" & request.form("delhospid") & ""
 
  conn.Execute sql
  conn.close
0
chris_desborough
Asked:
chris_desborough
1 Solution
 
Ryan ChongCommented:
>>Have a asp/vbscript application where I need to have a client-side msgbox popup and confirm before a delete takes place.

Client-side? Then you got to do it via Javascript instead on your form, try post your form here so that we can amend accordingly.
0
 
Loganathan NatarajanLAMP DeveloperCommented:
it can be done very well using client side?

you need to write the above code in the delete.asp file ... to be invoked when it is clicked ...



<script type="text/javascript">
<!--
function confirmation() {
        var answer = confirm("Are You Sure You Want To Delete This?")
        if (answer){
                return true;
        }
        else{
                return false;
        }
}
//-->
</script>
<a href="delete.asp" onclick="return confirmation()">DELETE</a>

Open in new window

0
 
mwhitworthCommented:
ASP can't do what Javascript will do in this case.  You can however code a separate page and on click have it open the secondary page and there ask the user to confirm deletion.
0
 
chris_desboroughAuthor Commented:
Thanks logudotcom, perfect answer to my problem.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now