Code:
function validateForm(myForm)
{
if (failure conditions)
{
show error message;
return false;
}
}
<form onsubmit="return validateForm(this);"></form>
This is the modified code from the first example. Follow the logic. There is no need for the
return true.
Onsubmit sends the input data to the
validateForm function. The function initially checks for
failure conditioins. If it fails, the error message is displayed, a
false conditions response is returned and your code should be set up to continue looping until a
return false response is not returned. If the function were to get past the failure conditions, it is assumed to be a success (
return true).
At least that's how I understand it.
