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
LVL 1
chris_desboroughAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.