function valid() { //client side validation of registration form var reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; var email = document.forms["register"]["email"].value; var password = document.forms["register"]["password"].value; var username = document.forms["register"]["username"].value; var repassword = document.forms["register"]["repassword"].value;
function valid()
ReplyDelete{
//client side validation of registration form
var reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
var email = document.forms["register"]["email"].value;
var password = document.forms["register"]["password"].value;
var username = document.forms["register"]["username"].value;
var repassword = document.forms["register"]["repassword"].value;
if (username == "")
{
alert('Username Required !');
document.forms["register"]["username"].focus();
return false;
}
if (email == "")
{
alert('Email Required !');
document.forms["register"]["email"].focus();
return false;
}
if (password == "")
{
alert('Password Required !');
document.forms["register"]["password"].focus();
return false;
}
if (email.match(reg))
{
return true;
}
else
{
alert('Invalid Email !');
document.forms["register"]["email"].focus();
return false;
}
if (password == repassword)
{
alert("Password doesn't match");
document.forms["register"]["repassword"].focus();
return false;
}
}