Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record Deletion - confirm

Status
Not open for further replies.

harrysdad

Programmer
May 30, 2002
53
0
0
GB
I am developing an application with Dreamweaver MX. I have knocked up a delete record page. Basically the user selects a surname from a drop-down box. This takes them to a page where the relevant record is displayed in full, with a "Delete Record" button. Upon deletion, the user is taken to a page that says "Record Deleted - Delete another?". However, before the user goes to this page, I want them to confirm deletion. I have put in a bit of JScript to do this. The problem is that the user is still taken to the "Record Deleted - delete another?" page, whether they choose OK or Cancel. This can lead to the confusing impression that records have been deleted when in fact they have not.

Can anyone help with a way around this?
 
Code:
<SCRIPT>
function confirm()
{

if (confirm(&quot;Delete Record?&quot;)) {
			document.location.href=&quot;[URL unfurl="true"]http://www.tek-tips.com&quot;}[/URL]
	else document.location.href=&quot;[URL unfurl="true"]http://www.hotmail.com&quot;[/URL]
}
</SCRIPT>
<A href=&quot;#&quot; onClick=&quot;test(); return false;&quot;>confirm</A>

not 100% sure if this'll solve your problem, but give it a go. it displays a confirm box, if somebody selects ok, it'll bring them to tek-tips.com, if they cancel it'll bring them to hotmail.com. I know that you don't want this in a function all of it's own, probably, but you can put the code in your own function as necessary.

good luck! :)
 
Thanks, but it doesn't work! If I click cancel, now the record does get deleted. It doesn't go to the nominated url either. It could be something to do with the code generated by Dreamweaver MX to delete the record...[sad]

 
what's the code that deletes the record? is it asp/php or something like that? perhaps you need to put in a confirm earlier in your code. for example confirm, if yes, delete record and go to page A, if confirm is no (cancel) go to page B. sorry i'm not of much help
 
>sorry i'm not of much help

Any reply is helpful - it helps get you on the right track. Thanks for replying.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top