-
Notifications
You must be signed in to change notification settings - Fork 6
/
pull4.html
150 lines (110 loc) · 3.65 KB
/
pull4.html
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<html>
<head>
<title>
formv
</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<style type="text/css">
.formelement{
margin-bottom:10px;
}
input{
width:320px;
font-size:25px;
border-radius:5px;
border:1px solid blue;
padding: 5px 5px 12px 5px;
}
#wrapper{
width:550px;
margin:0 auto;
background-color:red;
}
label {
position: relative;
top:12px;
width:200px;
float: left;
}
body{
font-size:130%;
}
#submitb{
width:330px;
margin-left:194px;
}
#errorMessage {
color: red;
font-size: 90% !important;
}
#successMessage {
color: green;
font-size: 90% !important;
display:none;
margin-bottom:20px;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="successMessage">You've done it! Congratulations.</div>
<div id="errorMessage"></div>
<div class="formelement">
<label id="email" >Email</label>
<input type="text" placeholder="eg [email protected]"></input>
</div>
<div class="formelement">
<label id="telephone">Telephone</label>
<input type="telephone" placeholder="******4143"></input>
</div>
<div class="formelement">
<label id="password">Password</label>
<input type="password"></input>
</div>
<div class="formelement">
<label id="cpassword">Confirm Password</label>
<input type="password"></input>
</div>
<div class="formelement">
<input type="submit" id="submitb" value="Sign Up">
</div>
</div>
<script type="text/javascript">
function isEmail(email) {
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return regex.test(email);
}
$("#submitb").click(function(){
var fieldmissing="";
var errormessage="";
if($("email").val()==""){
fieldmissing+="<br>Email"};
if($("telephone").val()==""){
fieldmissing+="<br>Telephone"};
if($("password").val()==""){
fieldmissing+="<br>Password"};
if ($("#cpassword").val() == "") {
fieldmissing += "<br>Confirm Password";
}
if (isEmail($("#email").val()) == false) {
errormessage += "<p>Your email address is not valid</p>";
}
if ($.isNumeric($("#telephone").val()) == false) {
errormessage += "<p>Your phone number is not numeric</p>"
}
if ($("#password").val() != $("#passwordConfirm").val()){
errormessage+="<p>Password not matching!"};
if (fieldmissing != "") {
errormessage += "<p>The following field(s) are missing:" + fieldmissing;
}
if (errormessage != "") {
$("#errorMessage").html(errorMessage);
} else {
$("#successMessage").show();
$("#errorMessage").hide();
}
});
</script>
</body>
</html>
<!Gaurav Work>