Html code:
<form action='save.php' method="post" onsubmit="return validate(this)">
some inputs here...
</form>
here validations are working fine. but not the confirm code. Javascript code:
function validate(theForm)
{
validations here for input fields....
/*confirm dialog*/
var sure = confirm("Are you sure to proceed ?");
if(sure == false)
{
return false;
}
else
{
return sure;
}
}
confirm displays dialog but onclick of 'ok' button it is not submitting the form is there any way to submit form on confirm dialog using javascript function. Thanks in advance.
As requested, answer-ing my comment:
Write your form validation function as:
function validate(theForm){
//validation stuff here
return confirm('Are you sure you want to proceed?');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With