-
Notifications
You must be signed in to change notification settings - Fork 10
/
trial-page.html
191 lines (168 loc) · 4.5 KB
/
trial-page.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!DOCTYPE html>
<html>
<head>
<title>Simple form</title>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
}
* {
box-sizing: border-box;
}
input[type="text"],
select,
textarea {
width: 100%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
resize: vertical;
}
input[type="submit"] {
background-color: #04aa6d;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #45a049;
}
.container {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
.heading {
background-color: #637a91;
text-align: center;
color: white;
margin: auto;
/* width: 50%; */
padding: 10px;
}
.btn {
background-color: #5fcf80;
text-align: center;
color: white;
margin: auto;
width: 100%;
padding: 10px;
}
.arrow {
border: solid black;
border-width: 0 3px 3px 0;
display: inline-block;
padding: 3px;
}
.right {
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
}
</style>
</head>
<body>
<div class="container">
<div class="heading">
<p>Get started today!</p>
</div>
<form onsubmit="return(validateHTMlform())" name="trialForm">
<label for="fname">First Name</label>
<input
type="text"
id="fname"
name="firstName"
placeholder="Your name.."
/>
<label for="lname">Last Name</label>
<input
type="text"
id="lname"
name="lastName"
placeholder="Your last name.."
/>
<label for="lname">Email</label>
<input
type="text"
id="lname"
name="emailId"
placeholder="Your last name.."
/>
<label for="lname">Password</label>
<input
type="text"
id="lname"
name="Password"
placeholder="Your last name.."
/>
<input type="submit" value="Claim your free trial" class="btn" />
</form>
<p>
You are agreeing to our
<span
><a href="#" style="text-decoration: none">Terms and Services</a>
</span>
</p>
</div>
</body>
<!-- <script src="./ind.js"></script> -->
<script>
function validateHTMlform() {
event.preventDefault();
let form = document.trialForm;
validateFirstName = form.firstName.value;
let isValidateFirstName = validateFirstName.match(/[^a-zA-Z]/g);
validateLastName = form.lastName.value;
let isValidateLastName = validateLastName.match(/[^a-zA-Z]/g);
validatePassword = form.Password.value;
let isValidatePassword = validatePassword.match(/^[0-9a-zA-Z]+$/);
if (validateFirstName == "") {
alert("Please provide First Name!");
form.firstName.focus();
return;
}
if (validateLastName == "") {
alert("Please provide last Name!");
form.lastName.focus();
return;
}
if (isValidateFirstName) {
alert("in first name numbers not allowed");
form.firstName.focus();
return;
}
if (isValidateLastName) {
alert("In last name numbers not allowed");
form.lastName.focus();
return;
}
var email = form.emailId.value;
// atpos = email.indexOf("@");
// dotpos = email.lastIndexOf(".");
const re =
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
let vhj = re.test(String(email).toLowerCase());
console.log(vhj, "vhjvhj");
if (email == "" || vhj == false) {
alert("Please enter correct email ID");
form.emailId.focus();
return;
}
if (validatePassword.length < 8) {
alert("password must be greater then 8");
form.Password.focus();
return;
}
if (isValidatePassword == null) {
alert("In password only text and number allowed");
form.Password.focus();
return;
}
alert("form submitted");
}
</script>
</html>