-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
54 lines (54 loc) · 1.52 KB
/
script.js
File metadata and controls
54 lines (54 loc) · 1.52 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
function validateForm() {
let x = document.forms["Reg Form"]["fname"].value;
let y = document.forms["Reg Form"]["uname"].value;
let z = document.forms["Reg Form"]["em"].value;
let a = document.forms["Reg Form"]["pass"].value;
let b = document.forms["Reg Form"]["cpass"].value;
let c = document.getElementById("c1").checked;
let d = document.getElementById("c2").checked;
let e = document.getElementById("c3").checked;
let f = document.getElementById("pno").value;
let at = z.indexOf("@");
if (x == "") {
alert("Name must be filled out");
return false;
}
if (y == "") {
alert("User name must be filled out");
return false;
}
if (z == "") {
alert("Email must be filled out");
return false;
}
if (at < 1) {
alert("Invalid email address");
return false;
}
if (f.length != 10) {
alert("Phone number must contain 10 digits");
return false;
}
if (isNaN(f)) {
alert("Phone number must contain only digits");
return false;
}
if (a == "") {
alert("You must enter password");
return false;
}
if (b == "") {
alert("You must confirm password");
return false;
}
if (a != b) {
alert("Your password does not match");
return false;
}
if (c == false && d == false && e == false) {
alert("Gender must be filled out");
return false;
}
alert("You have successfully registered");
return true;
}