I have a form like below, in onsubmit I have added a validation and also, I have added action.
My problem is onsubmit and action are running at same time. First I want to validate the form, if there validation error occurred, no need to run the php or action. If there is no error then php or action should be run. Please help me.
<form onsubmit="MM_validateForm()" action="code_exec.php" method="post" name="reg">