Confirm dialog box

M

Marc

Hello,

I have a form that lets the user click a submit button 'Delete'. It
deletes a record in a mySql databsae. I'd rarther have a JavaScript
alert asking the user 'Are you sure you want to do this?' before
submitting the form and deleting the record.

Like so:
user clicks 'Delete' button;
javascript alert appears 'are you sure?' [OK][Cancel];
[OK]: form gets submitted, record gets deleted;
[Cancel]: form gets not submitted, nothing happens.

Can anyone point me in the right direction?

Thanks,

Marc
 
K

kaeli

Hello,

I have a form that lets the user click a submit button 'Delete'. It
deletes a record in a mySql databsae. I'd rarther have a JavaScript
alert asking the user 'Are you sure you want to do this?' before
submitting the form and deleting the record.

I myself use a confirmation page. My pet users like to ignore alerts and
just click okay without reading them.
But, if you wish...

<form name="f1" action="whatever.asp" method="post" onSubmit="return
confirm('Are you sure you want to delete this? Don't be a moron and
click okay and then whine at me later that you deleted it by
accident.');">


--
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top