-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmaterial.html
More file actions
356 lines (330 loc) · 12.9 KB
/
material.html
File metadata and controls
356 lines (330 loc) · 12.9 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
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Material Design for a form</title>
<!-- MDL -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<!-- <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css"> -->
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.blue_grey-deep_purple.min.css">
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<style>
.hide {
display: none;
}
.submit__error,
.submit__error--empty {
color: #e74c3c;
}
label {
margin-bottom: 0;
}
.mdl-textfield {
width: 100%;
}
.mdl-textfield__expandable-holder {
width: calc(100% - 32px);
max-width: calc(100% - 32px);
}
.header {
background-color: #191919;
background-image: url('./leather.jpg');
background-size: contain;
min-height: 184px;
}
#dob::placeholder,
#address::placeholder {
color: #bdbdbd;
}
.title {
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
padding: 30px 0 17px;
}
.logo-container,
.form {
max-width: 575px;
margin: auto;
}
.form {
background: #fff;
box-shadow: 0px 1px 3px 0px rgba(173, 173, 173, 0.75);
padding-bottom: 30px;
position: relative;
top: -80px;
}
.logo-container img {
max-width: 80px;
margin-top: 10px;
}
.section-title {
margin-top: 40px;
}
.section-title h4 {
border-bottom: 1px solid #e0e0e0;
padding-bottom: 5px;
}
.beauty-product {
margin: 10px auto;
}
.submit__generated {
display: inline-block;
}
.submit__generated.valid:after, .submit__generated.unvalid:after {
font-family: FontAwesome;
font-size: 18px;
margin-left: 10px;
}
.submit__generated.valid:after {
content: "\f00c";
color: #2ecc71;
}
.submit__generated.valid .submit__input {
border: 1px solid #2ecc71;
color: #2ecc71 !important;
}
.submit__generated.unvalid:after {
content: "\f00d";
color: #e74c3c;
}
.submit__generated.unvalid .submit__input {
border: 1px solid #e74c3c;
color: #e74c3c;
}
.submit__generated .submit__input {
position: relative;
outline: 0;
height: 35px;
width: 35px;
border-radius: 4px;
border: 1px solid #42A0DD;
color: #42A0DD;
text-align: center;
font-weight: bold;
font-size: 16px;
top: -2px;
}
</style>
</head>
<body>
<header class="header">
<div class="logo-container">
<img src="bj.png" alt="">
</div>
</header>
<div class="form">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2 class="title">Request a sample here - LOVE beauty AND planet</h2>
<div class="text-muted">We have one goal - To make you more beautiful and give a little love to our planet. We want to help make a little difference with every shower towards a happier, less wasteful planet. Our approach is a holistic one, encompassing the entire product life cycle and beyond: we’ve given careful thought to our ingredients, product packaging, and social partnerships. We call it our passionate journey of #smallactsoflove, and we’re just getting started.</div>
</div>
<img src="Unilever-Love-Beauty-and-Planet_hydration.jpg" alt="" class="beauty-product">
<div class="col-md-12 section-title">
<h4>Personal Details</h4>
</div>
<div class="col-md-6">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="name">
<label class="mdl-textfield__label" for="name">Enter your first name <span>*</span></label>
</div>
</div>
<div class="col-md-6">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="lname">
<label class="mdl-textfield__label" for="lname">Enter your last name</label>
</div>
</div>
<div class="col-md-12">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--expandable">
<label class="mdl-button mdl-js-button mdl-button--icon" for="dob">
<i class="material-icons">date_range</i>
</label>
<div class="mdl-textfield__expandable-holder">
<input class="mdl-textfield__input" type="text" id="dob" readonly="readonly" placeholder="Date of birth (mm/dd/yyyy)">
<label class="mdl-textfield__label" for="dob">Expandable Input</label>
</div>
</div>
</div>
<div class="col-md-12">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="bj_membership_number" />
<label class="mdl-textfield__label" for="bj_membership_number">Enter BJ's Membership Number <span>*</span></label>
<span class="mdl-textfield__error">11 digits e.g. 123XXXXXXX, 444XXXXXXX, 555XXXXXXX</span>
</div>
</div>
<div class="col-md-12">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="email" id="email">
<label class="mdl-textfield__label" for="email">Enter your email address <span>*</span></label>
</div>
</div>
<div class="col-md-12 section-title">
<h4>Contact Details</h4>
</div>
<div class="col-md-12">
<div class="mdl-textfield mdl-js-textfield">
<input class="mdl-textfield__input" type="text" id="address" placeholder="Search your mailing address here...">
</div>
</div>
<div class="col-md-12">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="street_number">
<label class="mdl-textfield__label" for="street_number">Street Address 1</label>
</div>
</div>
<div class="col-md-12">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="route">
<label class="mdl-textfield__label" for="Route">Street Address 2</label>
</div>
</div>
<div class="col-md-12">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="locality">
<label class="mdl-textfield__label" for="locality">City</label>
</div>
</div>
<div class="col-md-12">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="administrative_area_level_1">
<label class="mdl-textfield__label" for="administrative_area_level_1">State</label>
</div>
</div>
<div class="col-md-12">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="postal_code">
<label class="mdl-textfield__label" for="postal_code">Postal Code</label>
</div>
</div>
<div class="col-md-12">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="country">
<label class="mdl-textfield__label" for="country">Country</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-12 section-title">
<h4>Are you human?</h4>
<label class="submit__control">
<div>
<div class="submit__generated"></div>
<i class="fa fa-refresh"></i>
</div>
<span class="submit__error hide">Incorrect value</span>
<span class="submit__error--empty hide">Required field cannot be left blank</span>
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 text-right">
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" id="submit">Submit</button>
</div>
</div>
</div>
</div>
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<!-- Datepicker -->
<script src="calendar.js"></script>
<!-- Bootstrap -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
-->
<!-- Google map scripts -->
<script>
var placeSearch, autocomplete;
var componentForm = {
street_number: 'long_name',
route: 'long_name',
locality: 'long_name',
administrative_area_level_1: 'long_name',
country: 'long_name',
postal_code: 'long_name'
};
function fillInAddress() {
var place = autocomplete.getPlace();
for (var component in componentForm) {
document.getElementById(component).value = '';
document.getElementById(component).disabled = false;
}
for (var i = 0; i < place.address_components.length; i++) {
var addressType = place.address_components[i].types[0];
if (componentForm[addressType]) {
var val = place.address_components[i][componentForm[addressType]];
document.getElementById(addressType).value = val;
}
}
for(var i =0; i < document.querySelectorAll('.mdl-textfield').length; i++) {
document.querySelectorAll('.mdl-textfield')[i].MaterialTextfield.checkDirty();
}
var route_temp = $("#route").val();
var street_number_temp = $("#street_number").val();
$("#street_number").val(street_number_temp + ', '+ route_temp);
$("#route").val('');
}
function myMap() {
autocomplete = new google.maps.places.Autocomplete((document.getElementById('address')),{types: ['geocode']});
autocomplete.addListener('place_changed', fillInAddress);
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAi-mKONX-DVRyQKGxcPMyRkZJzrYBXM_o&libraries=places&callback=myMap"></script>
<!-- DOM manipulation -->
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="captcha.js"></script>
<script>
function addInvalidClass(id) {
$("#"+id).parent('.mdl-textfield').addClass('is-invalid');
return false;
}
function isValidEmail(value) {
return (value.match(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/) !== null);
}
function checkValidityForNull(id) {
if($('#'+id).val() === '') {
addInvalidClass(id);
return false;
}
return true;
}
function checkValidityForEmail(id) {
var isNotNull = checkValidityForNull(id);
var isAValidEmail = isValidEmail($('#'+id).val());
if(!isAValidEmail)
addInvalidClass(id);
return isNotNull && isAValidEmail;
}
function checkValidityForMembership(id) {
var isNotNull = checkValidityForNull(id);
if(isNotNull) {
if($("#"+id).val().match(/(123|444|555)[0-9]{8}/) === null) {
addInvalidClass(id);
return false;
} else {
return true;
}
}
return false;
}
$("#submit").on('click', function() {
var isNameFieldValid = checkValidityForNull('name');
var isEmailFieldValid = checkValidityForEmail('email');
var isMembershipValid = checkValidityForMembership('bj_membership_number');
if(isNameFieldValid && isEmailFieldValid && isMembershipValid) {
alert("Thank you for the response. Your sample would be sent your address");
} else {
console.log("Fill the form to submit");
}
});
$( function() {
$( "#dob" ).datepicker();
});
</script>
</body>
</html>