-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform.html
More file actions
120 lines (107 loc) · 3.63 KB
/
form.html
File metadata and controls
120 lines (107 loc) · 3.63 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
funnction loadXmlDoc(){
try{
xmlHttp=new XMLHttpRequest();
}catch(Exception e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}catch(Exception e1){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch(Exception e2){
alert("AJAX not supported");
return false;
}
}
}
xmlHttp.onreadystatechange=processResponse;
var firstname=document.getElementById('fname');
var lastname=document.getElementById('lname');
var url='getResult.jsp?firstname=firstname&&lastname=lastname';
/*setup request using open method*/
xmlHttp.open("GET",url,true);
/*send the post request*/
xmlHttp.send(null);
}
/*callback function*/
function processResponse(){
if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
var sp=document.getElementById('result');
sp.innerText = xmlHttp.responseText;
}
}
/* form validation*/
function validation(thisform){
var fname=thisform.firstName.value;
var lname=thisform.lastName.value;
var e_mail=thisform.email.value;
var d=/^[\w\.\-\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-Z0-9]{2,4}$/;
var c=/^[0-9]+$/;
var pwd=thisform.password.value;
var cpwd=thisform.confirmPassword.value;
var p=/^[a-zA-Z0-9]+$/;
if(e_mail!=d){
alert("Invalid email");
thisform.email.focus();
return false;
}
if(pwd.length<8){
alert("password must contain atleast 8 character");
thisform.password.focus.focus();
return false;
}
if(cpwd!=pwd){
alert("password not matched");
thisform.pwd.focus();
return false;
}
}
</script>
<style>
input[type=text], input[type=password],input[type=email],input[type=number],input[type=file] {
width: 5%;
padding: 12px 20px;
margin: 8px 0;
border: 1px solid #ccc;
box-sizing: border-box;
}
/*styling for text field*/
input[type=text], input[type=password],input[type=email] ,input[type=number],input[type=file],button{
width:25%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
</style>
</head>
<body>
<p style="margin-top:-1%;">
<form action="register" method="get" >
<div style="width:97%;height:100%;padding:20px;background-color: pink;">
<h1 align="center"> REGISTRATION FORM</h1>
<p align="center">
<label><b>First Name : </b></label><br>
<input type="text" name="firstName" placeholder="Enter username" id="fname" required>
<br>
<label><b>Last Name : </b></label><br>
<input type="text" name="lastName" placeholder="Enter lastname" id="lname" required>
<br>
<label><b>Email:</b></label><br>
<input type="email" name="email" placeholder=" Enter email or phone " required><br>
<label><b> No :</b></label><br>
<input type="number" name="Adahar" placeholder="adhar" required><br>
<label><b>Password</b> </label><br>
<input type="password" name="password" placeholder="Enter password" required><br>
<label><b>Confirm Password</b></label><br>
<input type="password" name="confirmPassword" placeholder=" Re-enter password" required><br>
<button type="submit" style="background-color: green;">register</button>
</p>
</div>
</form>
</body>
</html>