confirm button
Moderator: General Moderators
confirm button
I have this button that when clicked executes an oracle statement that starts a new data page. How can I have a confirm button in javascript (I know php does not really do confirm buttons) that sends a value to my button to know weather or not to execute the oracle statement. I cannot put the php code that contains the execute inside the javascript because javascript is client side and the oracle will be ignored.
Re: confirm button
You add a function in the page HEAD like this:
Then you add an onSubmit attribute to your form tag (note that the HTML char after javascript is a colon):
Code: Select all
<script type="text/javascript">
function validateForm()
{
var r=confirm("Are you sure?");
if (r==true)
{
return true;
}
return false;
}
</script>Code: Select all
<form id="myForm" name="myForm" action="/" method="POST" onsubmit="javascript:validateForm();">