Use the JavaScript Console

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

So, not sure if this is FCC stuff, the challenge link has nothing to do with the question?
if you had a codepen, it might help ?
If you are using JS… mebbe the variables should look like… ?

 var username = document.forms["myForm"]["username"].value;

I don’t see anything in your included code which would prevent a form from submitting if the validation failed. I’m guessing that there are parts of your code that you did not include?

Oho you mean the html part?

Ok I’ll try…much appreciated