I am validating my form using javascript validation but it is not working as I see an error on console screen
"base.js:35 Uncaught SyntaxError: Unexpected identifier".
My javascript is as follows:
var user = {
signup : function() {
var firstname = document.signupform.first_name.value;
var email = document.signupform.email.value;
var password = document.signupform.password.value;
var confirmpassword = document.signupform.confirmpassword.value;
if (firstname == "")
{
alert("Please provide first name!")
document.signupform.first_name.focus();
}
else if (!validateEmail())
{
alert("Please provide valid email!")
document.signupform.email.focus() ;
}
else if (password == "")
{
alert("Please enter a valid password")
document.signupform.password.focus() ;
}
else if (password != confirmPassword)
{
alert("Passwords do not match.");
document.signupform.confirmpassword.focus() ;
}
else
{
return true
}
return false
}
validateEmail : function()
{
var emailID = document.signupform.email.value;
atpos = emailID.indexOf("@");
dotpos = emailID.lastIndexOf(".");
if (atpos < 1 || ( dotpos - atpos < 2 ))
{
return false;
}
return true;
},
}