adding delete confirmation

Discussion in 'ASP General' started by Mike Brearley, Jul 6, 2004.

  1. 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
     
    Mike Brearley, Jul 6, 2004
    #1
    1. Advertising

  2. Mike Brearley

    CJM Guest

    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" <> wrote in message
    news:...
    > 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
    >
    >
     
    CJM, Jul 6, 2004
    #2
    1. Advertising

  3. Mike Brearley

    Steven Burn Guest

    <%
    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" <> wrote in message
    news:...
    > 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
    >
    >
     
    Steven Burn, Jul 6, 2004
    #3
  4. Mike Brearley

    Bullschmidt Guest

    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!
     
    Bullschmidt, Jul 6, 2004
    #4
  5. Thanks... That was easy enough. :)


    "Bullschmidt" <-nospam> wrote in message
    news:...
    > 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!
     
    Mike Brearley, Jul 6, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sramruttun

    Re: delete confirmation in datagrid

    sramruttun, Jul 4, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    620
    sramruttun
    Jul 4, 2003
  2. Dotnet Guy

    Delete Confirmation

    Dotnet Guy, Oct 16, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    675
    Dwayne Wilkinson
    Oct 21, 2003
  3. Nedu N
    Replies:
    2
    Views:
    391
    Robert McLaws
    Dec 4, 2003
  4. Elton W
    Replies:
    0
    Views:
    3,310
    Elton W
    May 15, 2005
  5. Replies:
    0
    Views:
    384
Loading...

Share This Page