Javascript [delete] confirmation

Wednesday 22nd February

Meant to post this aaaaages ago in case I forgot where I found it originally, but of course I didn’t and so today I’ve had to dig around and find it again :)

This snippet of code pops up a confirmation dialog when, for example, you click a button on a web based form, making it ideal for building interfaces where you want to provide a preventative measure against accidental requests being made.

Check it out:

And here’s the code:

<input name=action type=submit value=Delete onClick="javascript:return confirm('Are you sure you want to delete this record?')"/>

Obviously you’ll need to set up methods for handling the different actions, but the key thing here is the javascript snippet.

Credit to CodeToad for the original posting.

One Response to “Javascript [delete] confirmation”

  1. Azzurra sez:

    Buon luogo, congratulazioni, il mio amico!

Leave a Reply