dafyddgj dafyddgj - 1 year ago 112
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 Source

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

function allValidation()
    return validateForm() && selectCountry() && validateEmail();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download