nibs
02-03-2003, 06:19 PM
Hi,
I am using the following HTML form and would like for the user to be warned that the Delete (Submit) button will permanently delete the file when they click submit.
The JS I am trying to obtain should offer the user an Ok or Cancel option. Cancel should do nothing and ok should just continue with the allocated task.
I have been trying to use this code below (Aside : Will the fact that I am using PHP affect the JavaScript).
As you can see the ELSE option in the head part of the code simply goes back a page BUT i don't want that I just want no action taken. If they click yes to continue as normal i.e. execute delete.php (Name of the file).
Thank you in advance,
Nibs
************ HEAD ****************
<SCRIPT LANGUAGE="JavaScript">
function drawAlert()
{
var answer=confirm(" Permanently Delete Job Description")
if (answer) {
document.write("");
}
else {
history.go(-1);
}
</script>
************ BODY ******************
<form name="viewJobs" action=" <? echo ($_SERVER['PHP_SELF']); ?> " method="post">
<input type="hidden" name="formSubmitted" value="1"/>
To delete a job description from the DGI Datbase :
<ol class="delAdmin">
<li>Type the Job Id of the job description you want to delete.</li>
<li>Ensure the "Delete Job Description" button is clicked.</li>
<li>Click the "Locate" button to locate the job description to be deleted.</li>
</ol><br><br>
<input align="center" name="searchTerm" type="text">
<input type="submit" value="Delete" class="submit" onClick="drawAlert()" >
I am using the following HTML form and would like for the user to be warned that the Delete (Submit) button will permanently delete the file when they click submit.
The JS I am trying to obtain should offer the user an Ok or Cancel option. Cancel should do nothing and ok should just continue with the allocated task.
I have been trying to use this code below (Aside : Will the fact that I am using PHP affect the JavaScript).
As you can see the ELSE option in the head part of the code simply goes back a page BUT i don't want that I just want no action taken. If they click yes to continue as normal i.e. execute delete.php (Name of the file).
Thank you in advance,
Nibs
************ HEAD ****************
<SCRIPT LANGUAGE="JavaScript">
function drawAlert()
{
var answer=confirm(" Permanently Delete Job Description")
if (answer) {
document.write("");
}
else {
history.go(-1);
}
</script>
************ BODY ******************
<form name="viewJobs" action=" <? echo ($_SERVER['PHP_SELF']); ?> " method="post">
<input type="hidden" name="formSubmitted" value="1"/>
To delete a job description from the DGI Datbase :
<ol class="delAdmin">
<li>Type the Job Id of the job description you want to delete.</li>
<li>Ensure the "Delete Job Description" button is clicked.</li>
<li>Click the "Locate" button to locate the job description to be deleted.</li>
</ol><br><br>
<input align="center" name="searchTerm" type="text">
<input type="submit" value="Delete" class="submit" onClick="drawAlert()" >