Faqts : Computers : Programming : Languages : JavaScript : Windows

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

54 of 98 people (55%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

I want a confirm box to ask me if i want to delete a certain record, can I integrate this with PHP?

Dec 11th, 2002 05:22
Mark Beadle, Andy Wright,


I know I have run into this problem before and here is my solution (xyz)
is an integer value...
<html>
<head><link REL="stylesheet" HREF="/admin2/style.css" type="text/css">
<script language="JavaScript">
<!--
//
function confirmDelete(xzy) {
   if (window.confirm("Delete object "+xyz+" now")) {
      document.myForm.confval.value=ktid;
      document.getconf.submit();
   }
}
// -->
</script></head>
The main body of the HTMl should contain  a form called myForm with a
hidden input field named confval. Confirming the alert box will submit
the form with all it's data.
In my case the user sets the whole thing off with 
 <a href=\"javascript:confirmDelete($ident)\">$img[trash]</a>"
img[trash] holding the entire <img> tag for a trashcan.
Hope this helps
Mark