
Originally Posted by
jdc
What I want to do is, when the delete button is clicked, provide the user with a messagebox stating, "You are about to delete a record, do you want to procede?"
if Yes is clicked, process the form.
If the confirmation is important, then it should be done through a server-side mechanism, just like input validation. Alternatively, make the user perform two actions so it won't be accidental: selecting a check box then a button, for instance. The final option would be to make the action reversible; a list of 'Trash'.
If you really must do this client-side, then the confirmation action must be added directly to the button as that's the only way to determine which was clicked.
Code:
function confirmDelete() {
return confirm('Are you sure you want to delete this entry?');
}
HTML Code:
<input name="modify" type="submit" value="Modify" onclick="return confirmDelete();">
Mike
Bookmarks