-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript.js
More file actions
28 lines (25 loc) · 858 Bytes
/
javascript.js
File metadata and controls
28 lines (25 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function clearErrors(){
errors=document.getElementsByClassName('ferrors');
for(let item of errors){
item.innerHTML="";
}
}
function seterror(id,error){
ele=document.getElementById(id);
ele.getElementsByClassName('ferror')[0].innerHTML=error;
}
function validateform(){
var returnval=true;
clearErrors();
var name=document.forms['myForm']["fname"].value;
if(name.length<5){
seterror("name","*The username you provided must have at least 5 characters");
returnval=false;
}
var password=document.forms['myForm']["fpassword"].value;
if(password.length<6){
seterror("password","*The password you provided must have at least 6 characters");
returnval=false;
}
return returnval;
}