Here's some javascript I use for such instances:
[CODE]
if (myForm.hidWhich.value == "delete")
{
var verify = prompt("You are about to delete this entry \n" +
"------------------------------------ \n \n" +
"To delete this entry you must type this phrase in the prompt
and click OK: \n \n" +
"--> KILL ENTRY!");
if (verify == "KILL ENTRY!")
{
myForm.submit();
return(true);
}
else
{
alert("Error: Could not delete entry becuase you either canceled
out or entered the wrong phrase! \n " +
"Your entry WAS NOT deleted.");
return(false);
}
}
[/CODE]
The user must click a button to delete the entry. This button calls as
function onClick; within that function is the above code. It requires
the user to enter an exact phrase. If the exact phrase is not entered,
it is returned false and the form never submits. If the correct phrase
is entered, it sumbits the form and I remove the entry from Postgresql.
So far I have not had any users accidentally delete anything.
The only problem is IE does not like the prompt() function -works
perfect in FireFox. In IE it doesn't display the text in the prompt
window, but if the correct phrase is entered it still works
Philippe Reynolds wrote:
Good day all,
I have a problem for you all..
I have a form that has has the ability to delete a lot of information
from my MySQL database.
I would like to create a bit of security, in case the user hits the
button by accident.
I would like to create an additionnal window that would appear that
would ask:
"Are you sure?" and then a "yes" and "no" buttons to confirm the
deletion or to cancel the command.
Any thougts??
Thanks for the assistance
Phil
--
D. Aaron Germ
Scarborough Library, Shepherd University
(304) 876-5423
"Well then what am I supposed to do with all my creative ideas- take a bath and wash myself with them? 'Cause that is what soap is for" (Peter, Family Guy)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php