Не могу понять, что не так с моей программой валидации. Уже все испробовал, ничего не получается.
Помогите пожалуйста.
<!DOCTYPE html>
<html>
<head>
<title>son</title>
<style type="text/css">
</style>
<script type="text/javascript" src="javs.js"></script>
</head>
<body>
<form action="" method="get">
<input type="text" name="name" placeholder="Input your name"><br><br>
<input type="text" name="surname" placeholder="Input your surname"><br><br>
<input type="text" name="login" placeholder="Input your login"><br><br>
<input type="password" name="password" placeholder="Input your password"><br><br>
<input type="password" name="confirm" placeholder="Input your password again"><br><br>
<input type="text" name="email" placeholder="Input your email"><br><br>
<label for="male">Male</label>
<input type="radio" name="radio" value = "Male" id="male">
<label for="female">Female</label>
<input type="radio" name="radio" value="Female" id="female">
<input type="submit" name="submit">
</form>
</body>
</html>
Js code
window.onload = function (){
isValid = true;
var f = document.forms[0];
f.addEventListener("sumbit", init, false);
function init(e){
if(!e) var e = window.event;
for(var i = 0; i < f.elements.length; i++){
var el = f.elements[i];
if(el.type == "text" || el.type == "email" || el.type =="password"){
if(el.value.length == 0)
isValid = false;
}
}
if(isValid == false){
e.preventDefaut();
alert("You didn't input all the forms")
}
}
}