dafyddgj dafyddgj - 1 day ago 4
Javascript Question

Calling multiple Javascript functions onSubmit

I'm trying to call multiple JavaScript functions. It submits even though my functions return false. I receive the alert messages but it submits anyway.

This is my form.

<form name="myform" id="myform" action="receipt.html" method="post" onSubmit="return allValidation();">

Answer

You aren't returning anything in allValidation so that it will continue to next method execution. Try this,

function allValidation()
{
    return validateForm() && selectCountry() && validateEmail();
}
Comments