-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidations.js
More file actions
75 lines (68 loc) · 1.54 KB
/
validations.js
File metadata and controls
75 lines (68 loc) · 1.54 KB
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
65
66
67
68
69
70
71
72
73
74
75
function Text1()
{
var correct_way= /^[A-Z a-z]+$ /
var a= document.getElementById("un").value;
if(a==" ")
{
document.getElementById("message1").innerHTML="* Fill the field";
return false;
}
if(a.length<3)
{
document.getElementById("message1").innerHTML="* Length should be more than 3";
return false;
}
if(a.length>15)
{
document.getElementById("message1").innerHTML="* Length should be less than 15";
return false;
}
}
function Text2()
{
var b=document.getElementById("pw1").value;
if(b=="")
{
document.getElementById("message2").innerHTML="*Enter password";
return False;
}
if(b.length <5)
{
document.getElementById("message2").innerHTML="*password should be atleast 6 charecters long";
return false;
}
if(b.length> 15)
{
document.getElementById("message2").innerHTML="*password length cant exceed 15 charecters ";
return false;
}
}
function Text3()
{
var x=document.getElementById("pw1").value;
var y=document.getElementById("pw2").value;
if(x!=y)
{
document.getElementById("message3").innerHTML="*passwords dont match ";
return false;
}
}
function mail()
{
var x=document.getElementById("em").value;
if(x=="")
{
document.getElementById("message4").innerHTML="*email cant be empty";
return false;
}
if(x.indexOf("@")<=0)
{
document.getElementById("message4").innerHTML="*invalid email";
return false;
}
if(x.charAt(a.length-4)!=".")
{
document.getElementById("message4").innerHTML="*invalid email";
return false;
}
}