-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform.htm
90 lines (86 loc) · 1.84 KB
/
form.htm
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
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<html>
<head>
<title> Registration FORM </title>
<h1 align="center"> Registration Form </h1>
<script>
function validateForm()
{
var l = /^[A-Za-z]+$/;
var x = document.forms["myForm"]["Name"].value;
if (x == "")
{
alert("Name must be filled out");
return false;
}
var y = document.forms["myForm"]["Email"].value;
if (y == "")
{
alert("Email must be filled out");
return false;
}
var z = document.forms["myForm"]["Password"].value;
if (z == "")
{
alert("password must be filled out");
return false;
}
var a = document.forms["myForm"]["Confirm Password"].value;
if (a == "")
{
alert("confirm password must be filled out");
return false;
}
if (z!=a)
{
alert("please enter same password");
return false;
}
if(x.match(l))
true;
else
{
alert("Name must only contain letters");
return false;
}
}
</script>
</head>
<body>
<form name="myForm" >
<table align="center" border="3" cellpadding="10" cellspacing="2">
<tr>
<td>Name</td>
<td>:</td>
<td><input type="text" name="Name"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input type="email" name="Email"></td>
</tr>
<tr>
<td>Phone no.</td>
<td>:</td>
<td><input type="tel" name="Phone no" pattern="[0-9]{10}"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input type="password" name="Password" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}"><br><span>please enter 8 digits</span></td>
</tr>
<tr>
<td>Confirm Password</td>
<td>:</td>
<td><input type="password" name="Confirm Password" ></td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td align="center" colspan="3"><input type="submit" name="Submit" value="Submit" onclick="return validateForm()"></td>
</tr>
</table>
</form>
</body>
</html>