[SOLVED] Javascript onSubmit question
Posted: Tue Apr 12, 2005 5:57 am
Hi, I want to get a page to prompt the admin user before they delete some games from my online game.
For some reason, I cannot get the onSubmit to trigger correctly:
In the <head> of the page, I have:
This should be triggered by the submit button for the following form:
However, in Firefox, the delete.php script is always fired as soon as I hit the submit button. I have tried replacing the "return " line with an alert to see if the function is even called, but it is not.
In IE, the comfirm prompt is displayed but irrespective of which button is clicked (OK or Cancel), the delete script is run.
I'm sure that it's something really obvious, I just can't see it right now.
Thanks in advance for any help that you can offer.
For some reason, I cannot get the onSubmit to trigger correctly:
In the <head> of the page, I have:
Code: Select all
<script type="text/javascript">
function confirmDelete(){
return (confirm("Are you quite sure that you wish to delete the selected game(s)?"));
}
</script>Code: Select all
<form name="frmStalledGames" id="frmStalledGames" action="delete.php" method="post" onSubmit="confirmDelete();">In IE, the comfirm prompt is displayed but irrespective of which button is clicked (OK or Cancel), the delete script is run.
I'm sure that it's something really obvious, I just can't see it right now.
Thanks in advance for any help that you can offer.