-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsignup.js
79 lines (76 loc) · 2.82 KB
/
signup.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// first name vaildation
function validateFirstName () {
var fName= document.getElementById("firstName").value;
var rel = /^[a-zA-Z\s\'\-]{2,15}$/;
if(rel.test(fName)){
document.getElementById("firstNamePrompt").style.color="green";
document.getElementById("firstNamePrompt").innerHTML="<strong>valid</strong>";
return true;
}
else {
document.getElementById("firstNamePrompt").style.color="Red";
document.getElementById("firstNamePrompt").innerHTML="<strong>Enter 2-15 charcherts</strong>";
return false;
}
}
// last name validation
function validateLastName () {
var lName= document.getElementById("lastName").value;
var rel2 = /^[a-zA-Z\s\'\-]{2,15}$/;
if(rel2.test(lName)){
document.getElementById("lastNamePrompt").style.color="green";
document.getElementById("lastNamePrompt").innerHTML="<strong>valid</strong>";
return true;
}
else {
document.getElementById("lastNamePrompt").style.color="Red";
document.getElementById("lastNamePrompt").innerHTML="<strong>Enter 2-15 charcherts</strong>";
return false;
}
}
// email vaildation
function validateMails() {
var mName= document.getElementById("signupmail").value;
var rel4 = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
if(rel4.test(mName)){
document.getElementById("mailsPrompt1").style.color="green";
document.getElementById("mailsPrompt1").innerHTML="<strong>valid</strong>";
return true;
}
else {
document.getElementById("mailsPrompt1").style.color="Red";
document.getElementById("mailsPrompt1").innerHTML="<strong>Use correct format</strong>";
return false;
}
}
// password formpage validation
var rel;
function validatePassword() {
var pasName= document.getElementById("pwd").value;
var rel5 = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
rel=pasName;
if(rel5.test(pasName)){
document.getElementById("passPrompt").style.color="green";
document.getElementById("passPrompt").innerHTML="<strong>valid</strong>";
return true;
}
else {
document.getElementById("passPrompt").style.color="Red";
document.getElementById("passPrompt").innerHTML="<strong>Use atlest one uppercase letter,special character and numbers</strong>";
return false;
}
}
// repeat Password
function validateRePassword() {
var repasName= document.getElementById("Pwd").value;
if(repasName == rel) {
document.getElementById("repassPrompt").style.color="green";
document.getElementById("repassPrompt").innerHTML="<strong>Password Matched</strong>";
return true;
}
else {
document.getElementById("repassPrompt").style.color="Red";
document.getElementById("repassPrompt").innerHTML="<strong>Password not match</strong>";
return false;
}
}