Forum Moderators: open

Message Too Old, No Replies

Confirm before delete a record doesn't work, Help, please!

         

stud3

11:10 pm on Feb 17, 2005 (gmt 0)

10+ Year Member



Hi,
I have a problem.
I have a site, this site shows me a table with rows you can select, if you want to change or delete it. There are two buttons "delete" and "update" on the left side of every row, so if I click "delete" I would like a confirm Message for the selected row:"Do you want to delete the row with the Product_id = Number of the selected Product_id". It is difficult.
I saw a topic hier at Javascript, I made the same,what somebody explained, but it didn't work.
I would like to post my files, if it is possible (I hope), because
I think you can have a better view of what I intend to do and how is the structure of my Program, so maybe it is easier to find the error. I study hier in Germany, so the button names are in german, that would be no problem, I can translate it. I really need Help. Regards.

mattglet

1:50 am on Feb 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Something along these lines:

<script type = "text/javascript">
function doConfirmDelete(id, number) {
if (confirm('You are about to delete ' + id + ' = ' + number + '. Are you sure you want to do this?')) {
document.location.href = 'your_delete_file.asp?id=' + id;
}else{
return false;
}
}
</script>

<a href = "your_delete_file.asp" onclick = "return doConfirmDelete(<%=rs("item_id")%>, '<%=rs("item_number")%>');">Delete</a>

stud3

9:55 am on Feb 18, 2005 (gmt 0)

10+ Year Member



hi mattglet,
thanks for answering and helping me, it worked!, I'm so happy!, now I have to find a solution for the update of rows. I will write once again and explain my problem about that in another topic. Delete works!. Thanks!. Regards.