The function
Code:
<script type='text/javascript'>
function validateForm()
{
alert("We are called");
var x=document.forms["formbox"]["strLeadFirstName"].value;
alert("form name: " + x);
if (x==null || x=="")
{
alert("First name must be filled out");
return false;
}
var x=document.forms["formbox"]["strLeadPhone1"].value;
if (x==null || x=="")
{
alert("Atleast 1 Phone Number must be filled out");
return false;
}
var x=document.forms["formbox"]["strLeadEmail"].value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
{
alert("Not a valid e-mail address");
return false;
}
}
</script>
How it is called:
Code:
<form name="formbox" action="http://active.flg360.co.uk/api/APIHTTPPost.php" method="post" id="lead_form" onSubmit="javascript:return validateForm()">
Tried debugging with Bart on IRC but "We are called" is called and alerts but the others don't work...
Any help?
-Boom