-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyle.js
64 lines (54 loc) · 1.63 KB
/
style.js
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
function clearError(){
errors=document.getElementById('error');
for(let item in errors){
item.innerHTML="";
}
}
function setError(id,msg){
element=document.getElementById(id);
element.getElementsByClassName('error')[0].innerHTML=msg;
}
function validate(){
var val=true;
clearError();
var user=document.forms["reg"]["user"].value.trim();
if(user.length<3 && user.length>0){
setError("user",'*User name must have minimum 3 char')
val=false;
} else if(user==""){
setError("user",'*User name cannot be blank');
val=false;
}
var email=document.forms["reg"]["email"].value;
if(email==""){
setError("mail",'*Enter email');
val=false;
}
var phone=document.forms["reg"]["num"].value;
if(phone.length!=10){
setError("phone",'*Number must have 10 digits');
val=false;
}
var pass=document.forms["reg"]["pass"].value;
if(pass.length<6 && pass.length>0){
setError("pass",'*Length of password must be greater than 6');
val=false;
}else if(pass.length==0){
setError("pass",'*password required');
val=false;
}
var cpass=document.forms["reg"]["cpass"].value;
if(cpass!=pass){
setError("cpass",'*Password not matched');
val=false;
}else if(cpass==""){
setError("cpass",'*Enter confirmed password');
val=false;
}
var address=document.forms["reg"]["address"].value;
if(address==""){
setError("add",'*Enter your address');
val=false;
}
return val;
}