Simple Confirmation Code for a Delete Button

Discussion in 'Javascript' started by Les Juby, Aug 4, 2005.

  1. Les Juby

    Les Juby Guest

    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 %>" onclick="javascript:return
    confirm('Are you ABSOLUTELY SURE you want to DELETE this record
    ?')">Delete record</a>

    On several sites I use short form constructs to generate a more
    recognizable button, and would like to use a simple script such as
    this to give the conformation option.

    ie.
    <form action="delete2.asp" method="post">
    <input type="hidden" name="which2" value=345">
    <input type="submit" value="Delete">

    Could this script be modified.?

    Any alternative.?

    .les.
     
    Les Juby, Aug 4, 2005
    #1
    1. Advertising

  2. Les Juby

    Les Juby Guest

    On Thu, 04 Aug 2005 04:53:07 GMT, (Les
    Juby) wrote:

    > onclick="javascript:return
    >confirm('Are you ABSOLUTELY SURE you want to DELETE this record
    >?')"


    OK. I worked it out......

    onclick gets replaced by onsubmit !!!!

    .les.
     
    Les Juby, Aug 4, 2005
    #2
    1. Advertising

  3. Les Juby

    Phat G5 (G3) Guest

    in article , Les Juby at
    wrote on 8/3/05 9:53 PM:

    > 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 %>" onclick="javascript:return
    > confirm('Are you ABSOLUTELY SURE you want to DELETE this record
    > ?')">Delete record</a>
    >
    > On several sites I use short form constructs to generate a more
    > recognizable button, and would like to use a simple script such as
    > this to give the conformation option.
    >
    > ie.
    > <form action="delete2.asp" method="post">
    > <input type="hidden" name="which2" value=345">
    > <input type="submit" value="Delete">
    >
    > Could this script be modified.?
    >
    > Any alternative.?
    >
    > .les.
    >

    Sure it could.

    Either

    <form action="delete2.asp" method="post" onsubmit="return confirm('Are you
    ABSOLUTELY SURE you want to DELETE this record ?');">

    OR

    <input type="submit" value="Delete"onclick="javascript:return
    confirm('Are you ABSOLUTELY SURE you want to DELETE this record ?')">


    HTH,

    --Steffan
     
    Phat G5 (G3), Aug 5, 2005
    #3
    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:
    623
    sramruttun
    Jul 4, 2003
  2. Dotnet Guy

    Delete Confirmation

    Dotnet Guy, Oct 16, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    679
    Dwayne Wilkinson
    Oct 21, 2003
  3. Nedu N
    Replies:
    2
    Views:
    392
    Robert McLaws
    Dec 4, 2003
  4. =?Utf-8?B?dmNvcm5qYW1i?=
    Replies:
    3
    Views:
    1,105
    Dan Bass
    Nov 29, 2004
  5. johnmott
    Replies:
    0
    Views:
    597
    johnmott
    Sep 12, 2007
Loading...

Share This Page