Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Simple Confirmation Code for a Delete Button

Reply
Thread Tools

Simple Confirmation Code for a Delete Button

 
 
Les Juby
Guest
Posts: n/a
 
      08-04-2005
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.

 
Reply With Quote
 
 
 
 
Les Juby
Guest
Posts: n/a
 
      08-04-2005
On Thu, 04 Aug 2005 04:53:07 GMT, http://www.velocityreviews.com/forums/(E-Mail Removed) (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.

 
Reply With Quote
 
 
 
 
Phat G5 (G3)
Guest
Posts: n/a
 
      08-04-2005
in article (E-Mail Removed), Les Juby at
(E-Mail Removed) 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sample code: Add delete confirmation to a GridView Control. johnmott ASP .Net 0 09-12-2007 03:51 PM
Confirmation on a Delete button contained in a WebControls DataGri =?Utf-8?B?dmNvcm5qYW1i?= ASP .Net 3 11-29-2004 09:17 AM
Datagrid Item Delete Confirmation not working Nedu N ASP .Net 2 12-04-2003 02:16 AM
Delete Confirmation Dotnet Guy ASP .Net 4 10-21-2003 03:50 AM
Re: delete confirmation in datagrid sramruttun ASP .Net 0 07-04-2003 06:47 AM



Advertisments