Hello guys
so am trying to validate the below details for my registration page but still when submit wrong details it still add user to the database…i am new in this language
please help me
thank you
Your code so far
function formValidation()
{
var username = document.myform.username;
var password = document.myform.password;
var email = document.myform.email;
var confirmpassword = document.myform.confirmpassword;
}
}
}
}
return false;
}
function confirmpassword_validation(confirmpassword,mx,my)
{
var confirmpassword_len = confirmpassword.value.length;
if (confirmpassword_len == 0 ||confirmpassword_len >= my || confirmpassword_len < mx)
{
alert("Password should not be empty / length be between "+mx+" to "+my);
confirmpassword.focus();
return false;
}
return true;
}
function password_validation(password,mx,my)
{
var password_len = password.value.length;
if (password_len == 0 ||password_len >= my || password_len < mx)
{
alert("Password should not be empty / length be between "+mx+" to "+my);
password.focus();
return false;
}
return true;
function allLetter(username)
{
var letters = /^[A-Za-z]+$/;
if(username.value.match(letters))
{
return true;
}
else
{
alert('Username must have alphabet characters only');
username.focus();
return false;
}
}
function ValidateEmail(email)
{
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if(email.value.match(mailformat))
{
return true;
}
else
{
alert("You have entered an invalid email address!");
email.focus();
return false;
}
}
</script>
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/use-the-javascript-console