473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

adding delete confirmation

How would I add a delete confirmation popup box for the following?

Here's what I have... A table (not a form) that contains this line:

<td align="center"><a
href="delete.asp?username=<%=rsUsers("username")%> &startletter=<%=startlette
r%>">Delete user</a></td>

And delete.asp looks like this...

----------------------------------------------
<%
Option Explicit
Dim username,rsDelete,startletter

startletter = Request.QueryString("startletter")

if Session("fewmetadminlogin") = "True" then

username = Request.QueryString("username")
%>
<!--#include file="../includes/conn.asp"-->
<%
set rsDelete = conn.Execute("DELETE * FROM users WHERE username = '" &
username & "'")

conn.close
set conn = nothing
end if

Response.Redirect("default.asp?startletter=" & startletter)
%>

---------------------------------------------

--
Posted 'as is'. If there are any spelling and/or grammar mistakes, they
were a direct result of my fingers and brain not being synchronized or my
lack of caffeine.

Mike Brearley
Jul 19 '05 #1
4 3211
CJM
You can either do something in Javascript (in which post a question in
microsoft.public.scripting.jscript) or you can use ASP to post to another
form where the question can be asked.

By the looks of it, you are looking at a Javascript solution..

Chris

"Mike Brearley" <mi*******************@NOSPAMhotmail.com> wrote in message
news:Oj**************@TK2MSFTNGP09.phx.gbl...
How would I add a delete confirmation popup box for the following?

Here's what I have... A table (not a form) that contains this line:

<td align="center"><a
href="delete.asp?username=<%=rsUsers("username")%> &startletter=<%=startlette r%>">Delete user</a></td>

And delete.asp looks like this...

----------------------------------------------
<%
Option Explicit
Dim username,rsDelete,startletter

startletter = Request.QueryString("startletter")

if Session("fewmetadminlogin") = "True" then

username = Request.QueryString("username")
%>
<!--#include file="../includes/conn.asp"-->
<%
set rsDelete = conn.Execute("DELETE * FROM users WHERE username = '" &
username & "'")

conn.close
set conn = nothing
end if

Response.Redirect("default.asp?startletter=" & startletter)
%>

---------------------------------------------

--
Posted 'as is'. If there are any spelling and/or grammar mistakes, they
were a direct result of my fingers and brain not being synchronized or my
lack of caffeine.

Mike Brearley

Jul 19 '05 #2
<%
Option Explicit
Dim username,rsDelete,startletter
startletter = Request.QueryString("startletter")
if Session("fewmetadminlogin") = "True" then
if request.querystring("confirm_delete")="Yes" then
username = Request.QueryString("username")
%>
<!--#include file="../includes/conn.asp"-->
<%
set rsDelete = conn.Execute("DELETE * FROM users WHERE username = '"
& username & "'")
conn.close
set conn = nothing
else
%>
<a href="<%=request.servervariables("url")%>&confirm_ delete=Yes">Aww, go
on then</a>
<%
end if
end if
Response.Redirect("default.asp?startletter=" & startletter)
%>
--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Mike Brearley" <mi*******************@NOSPAMhotmail.com> wrote in message
news:Oj**************@TK2MSFTNGP09.phx.gbl...
How would I add a delete confirmation popup box for the following?

Here's what I have... A table (not a form) that contains this line:

<td align="center"><a
href="delete.asp?username=<%=rsUsers("username")%> &startletter=<%=startlette r%>">Delete user</a></td>

And delete.asp looks like this...

----------------------------------------------
<%
Option Explicit
Dim username,rsDelete,startletter

startletter = Request.QueryString("startletter")

if Session("fewmetadminlogin") = "True" then

username = Request.QueryString("username")
%>
<!--#include file="../includes/conn.asp"-->
<%
set rsDelete = conn.Execute("DELETE * FROM users WHERE username = '" &
username & "'")

conn.close
set conn = nothing
end if

Response.Redirect("default.asp?startletter=" & startletter)
%>

---------------------------------------------

--
Posted 'as is'. If there are any spelling and/or grammar mistakes, they
were a direct result of my fingers and brain not being synchronized or my
lack of caffeine.

Mike Brearley

Jul 19 '05 #3
Here's something similar I've done using onclick and javascript:

<% ' *** btnDel %>
<input type="submit" name="btnDel" value="Delete" onclick="return
confirm('Are you sure you want to delete this record?');">

Best regards,
J. Paul Schmidt, Freelance ASP Web Designer
http://www.Bullschmidt.com
ASP Designer Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #4
Thanks... That was easy enough. :-)
"Bullschmidt" <pa**@bullschmidt.com-nospam> wrote in message
news:un*************@TK2MSFTNGP12.phx.gbl...
Here's something similar I've done using onclick and javascript:

<% ' *** btnDel %>
<input type="submit" name="btnDel" value="Delete" onclick="return
confirm('Are you sure you want to delete this record?');">

Best regards,
J. Paul Schmidt, Freelance ASP Web Designer
http://www.Bullschmidt.com
ASP Designer Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Les Juby | last post by:
I've used a simple javascript for some time (no entries required up in the <head> tag) that asks for a confirmation before deleting. ie. <a href="/delete.asp?which=345 %>"...
6
by: Dotnet Guy | last post by:
I want to add a confirmation dialog box before I delete the records in my form. I have a piece of javascript code in html that checks for confirmation. But the main issue lies in calling this...
0
by: Elton W | last post by:
Hi Peter, You use DeleteButton.Attributes.Add("onclick", "return confirm ('Are you sure you want to delete?');"); in datagrid_ItemDataBound event to add confirmation for delete button.
0
by: Suzanne | last post by:
I'd like to know how can I put up a confirmation question when the user tries to delete a row in the datagrid by clicking on the row header and pressing the Delete key? I have found this code on...
5
by: Samy | last post by:
Hi There, I have a label in a datagrid which I make it a input type = radio in ItemDataBound so that radio buttons are shown in the datagrid. This is how I have it... ASPX... <asp:Label...
17
by: (PeteCresswell) | last post by:
I've got apps where you *really* wouldn't want to delete certain items by accident, but the users just have to have a "Delete" button. My current strategies: Plan A:...
0
by: rajeshgujar | last post by:
Here is What needs to be Done In Your DataGrid do this 1 ] Private Sub DGReference_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles...
14
by: darrel | last post by:
Is it possible to pre-empt the javascript function used to do a postback from a linkbutton? I'd like to use linkbutton to delete a record and want to add a confirmation box via javascript "are...
0
by: Eraser | last post by:
Hi to all .NET guru guys... I have a problem in my delete button inside gridview. How to avoid postback on when i select cancel on confirmation message? But postback is okay on Ok confirmation....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.