I’ve got a problem trying to validate multiple forms -when the user submits any of the 3 forms, the validation code will validate the other 2 forms as well.
<form action="php/signupform.php" method="post" name="signup" id="signup" class="smallcontact" onsubmit="return Verify(this);">
<form action="php/questionform.php" method="post" name="askquestion" id="askquestion" class="smallcontact" onsubmit="return Verify(this);">
<form action="php/contactform.php" method="post" name="contactform" id="contactform" onsubmit="return Verify(this);">
The JS that checks the email input looks like this:
var checkEmail = document.getElementById('signupemail').value;
if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.')))
{
errors += "- You have entered an invalid email address.
";
document.getElementById('signupemail').select();
return false;
}
var checkEmail = document.getElementById('questionemail').value;
if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.')))
{
errors += "- You have entered an invalid email address.
";
document.getElementById('questionemail').select();
//return false;
}
var checkEmail = document.getElementById('contactemail').value;
if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.')))
{
errors += "- You have entered an invalid email address.
";
document.getElementById('contactemail').select();
//return false;
}
Oh yes, the Submit button code looks like this:
<input type="submit" name="Submit" value="Submit" class="submit"/>