-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform5.html
487 lines (450 loc) · 18.2 KB
/
form5.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
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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" href="index.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script>
function calling2() {
var gender =document.getElementsByName("radios");
var breakfast = document.getElementsByName("breakfast");
var desserts = document.getElementsByName("desserts");
var appetizers = document.getElementsByName("appetizers");
var lunch = document.getElementsByName("lunch");
var ans = "";
for(var i=0;i<gender.length;i++){
if(gender[i].checked)
{
ans+="Your gender is: "+gender[i].value+"\n";
}
else{
ans+="Please check"+"\n";
}}
for (var i = 0; i < breakfast.length; i++) {
if (breakfast[i].checked) {
ans +=
"The calories of :" +
breakfast[i].id+
" are :" +
breakfast[i].value +
"\n";
}
}
for (var i = 0; i < desserts.length; i++) {
if (desserts[i].checked) {
ans +=
"The calories of :" +
desserts[i].id +
" are :" +
desserts[i].value +
"\n";
}
}
for (var i = 0; i < appetizers.length; i++) {
if (appetizers[i].checked) {
ans +=
"The calories of :" +
appetizers[i].id +
" are :" +
appetizers[i].value +
"\n";
}
}
for (var i = 0; i < lunch.length; i++) {
if (lunch[i].checked) {
ans +=
"The calories of :" +
lunch[i].id +
"are :" +
lunch[i].value +
"\n";
}
}
return ans;
}
</script>
<script>
function validtion(e) {
//check validation for name
var ans = "";
var username = document.getElementById("usernameid").value;
if (username == "") {
document.getElementById("span1").innerHTML =
"Please enter your name again<br>";
}
else
document.getElementById("span1").innerHTML =" ";
//check validation for email
var email1 = document.getElementById("emailid").value;
var email2 = document.getElementById("emailidConform").value;
if (email1 != email2) {
document.getElementById("span2").innerHTML =
"Please enter your email again<br>";
}
else if(email1==""||email2==""){
document.getElementById("span2").innerHTML =
"Please enter your email ";}
else{
document.getElementById("span2").innerHTML ="";
}
//check validation for radio
var radio = document.getElementsByName("radios");
var radioVlaue = 0;
var check;
for (var i = 0; i < radio.length; i++) {
if (radio[i].checked) {
radioVlaue += 1;
}
check = radio[i].value;
}
if (radioVlaue == 0)
document.getElementById("span3").innerHTML = "please check ";
else
document.getElementById("span3").innerHTML = " ";
// check validation for checkbox
if (e == 4) {
document.getElementById("span4").innerHTML = "please check ";
}
else
document.getElementById("span4").innerHTML = " ";
}
</script>
<script>
function cal1() {
//check if it is checked or not
var x = document.getElementsByName("level");
var temp = "";
var e = 0;
for (var i = 0; i < x.length; i++) {
if (x[i].checked) {
temp += x[i].value;
} else {
e += 1;
}
}
if (e == 4) {
validtion(e);
} else show(temp);
}
function show(t) {
//prepare the next checkbox
var output = "<br><br><div class='form-check form-check-inline'>";
for (var i = 0; i < t.length; i++) {
//at the value change it to right caloire and at foodc change it to the name of the meal
if (t[i] == "2") {
output +=
"<label class='form-check-label'> choose from breakfast:" +
"<input type='checkbox' name='breakfast' value='1018' id='Pancake'>Pancake" +
"<input type='checkbox' name='breakfast' value='287' id='Omelette'>Omelette" +
"<input type='checkbox' name='breakfast' value='1107' id='French Toast'>French Toast" +
"</label><br>";
} else if (t[i] == "3") {
output +=
"<label class='form-check-label'> choose from desserts:" +
"<input type='checkbox' name='desserts' value='5540' id='Lazy Cake'>Lazy Cake" +
"<input type='checkbox' name='desserts' value='3073' id='Cookies'>Cookies" +
"<input type='checkbox' name='desserts' value='1724' id='Mini cheesecakes'>Mini cheesecakes" +
"</label><br>";
} else if (t[i] == "4") {
output +=
"<label class='form-check-label'> choose from appetizers:" +
"<input type='checkbox' name='appetizers' value='2783' id='Cabbage salad'>Cabbage salad" +
"<input type='checkbox' name='appetizers' value='1040' id='Vegetables soup'>Vegetables soup" +
"<input type='checkbox' name='appetizers' value='792.06' id='Tabouli'>Tabouli" +
"</label><br>";
} else if (t[i] == "1"){
output +=
"<label class='form-check-label'> choose from lunch:" +
"<input type='checkbox' name='lunch' value='1004' id='Chicken Sandwiches'>Chicken Sandwiches" +
"<input type='checkbox' name='lunch' value='3267' id='Lasagna'>Lasagna" +
"<input type='checkbox' name='lunch' value='1413' id='Pizza'>Pizza" +
"</label><br>";
}
// else{
// "<label>please check</label>"
// document.getElementsByName("level").innerHTML =
// "please check<br>";
// }
}
document.getElementById("first").innerHTML =
output +
"</form>" +
"<input type='button' value='select' onclick='cal2()'' /> ";
}
function cal2() {
var x = document.getElementsByName("breakfast");
var all = 0;
for (var i = 0; i < x.length; i++) {
if (x[i].checked) {
all += parseInt(x[i].value);
}
}
var x = document.getElementsByName("desserts");
for (var i = 0; i < x.length; i++) {
if (x[i].checked) {
all += parseInt(x[i].value);
}
}
var x = document.getElementsByName("appetizers");
for (var i = 0; i < x.length; i++) {
if (x[i].checked) {
all += parseInt(x[i].value);
}
}
var x = document.getElementsByName("lunch");
for (var i = 0; i < x.length; i++) {
if (x[i].checked) {
all += parseInt(x[i].value);
}
}
document.getElementById("floatingTextarea2").value =
"Username is : "+document.getElementById("usernameid").value+"\n"
+"Email is : "+document.getElementById("emailid").value+"\n"
+"Calories are: " + all+"\n"+calling2()+"\n";
}
</script>
</head>
<body>
<!--Navbar-->
<nav class="navbar navbar-expand-lg" style="background-color: #ffffff">
<div class="container-fluid">
<a class="navbar-brand" href="#"><img src="tpictures/logo6.png" /></a>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item ">
<a class="nav-link " href="index.html" style="color: #4cab4c"
>Home</a
>
</li>
<li class="nav-item">
<a class="nav-link" href="About_us.html" style="color: #4cab4c"
>About_us</a
>
</li>
<li class="nav-item dropdown">
<a
class="nav-link dropdown-toggle"
href="services.html"
role="button"
data-bs-toggle="dropdown"
aria-expanded="false"
style="color: #4cab4c"
>
services
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="services.html">Latest Recipies</a></li>
<li><a class="dropdown-item" href="#">Appetizers</a></li>
<li><a class="dropdown-item" href="#">Breakfast</a></li>
<li><a class="dropdown-item" href="#">Desserts</a></li>
<li><a class="dropdown-item" href="#">Lunch</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="testimonial.html" style="color: #4cab4c"
>testimonial</a
>
</li>
<li class="nav-item">
<a
class="nav-link"
href="Contact_us.html"
style="color:#4cab4c "
>Contact_us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="SiteMap.html" style="color: #4cab4c"
>SiteMap</a
>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="form5.html" style="color: #093532"
>Register</a
>
</li>
</ul>
<form class="d-flex" role="search">
<input
class="form-control me-2"
type="search"
placeholder="Search"
aria-label="Search"
/>
<button class="btn" style="background-color: #ef8451" type="submit">
Search
</button>
</form>
</div>
</div>
</nav>
<br>
<br>
<h1 style="text-align: center; color: #4cab4c ;">Register with us</h1>
<!-- <script>
//time and date
var date = new Date();
document.write(" " + date.getDate() + " - " + (date.getMonth() + 1) + " - " + date.getFullYear() + "");
document.write(" " + date.getHours() + " : " + date.getMinutes() + " : " + date.getSeconds() + "<br>");
</script> -->
<div style="text-align: center;">
<script>
//time and date
var date = new Date();
document.write(" " + date.getDate() + " - " + (date.getMonth() + 1) + " - " + date.getFullYear() + "");
document.write(" " + date.getHours() + " : " + date.getMinutes() + " : " + date.getSeconds() + "<br>");
</script>
</div>
<div class="container">
<form action="">
<div class="row" style="text-align: center;">
<div class="col lg-10 sm-4">
<!-- Username -->
<label style="margin-bottom: 2%; margin-top: 2%; color:#ef8451; ">Enter Your name:</label>
<div class="input-group flex-nowrap">
<input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="addon-wrapping" style="margin-left: 25%; margin-right: 25%;" id="usernameid">
</div>
<span id="span1"></span>
<br>
</div>
</div>
<div class="row" style="text-align: center;">
<div class="col lg-10 sm-4">
<!-- Email -->
<label style="margin-bottom: 2%; margin-top: 2%; color:#ef8451; ">Enter a valid Email:</label>
<div class="input-group flex-nowrap">
<input type="text" class="form-control" placeholder="Email" aria-label="Email" aria-describedby="addon-wrapping" style="margin-left: 25%; margin-right: 25%;" id="emailid">
</div>
<!-- <span id="span2"></span> -->
<br>
</div>
</div>
<div class="row" style="text-align: center;">
<div class="col lg-10 sm-4">
<!-- Email confirmation-->
<label style="margin-bottom: 2%; margin-top: 2%; color:#ef8451; ">Confirm your Email:</label>
<div class="input-group flex-nowrap">
<input type="text" class="form-control" placeholder="Email" aria-label="Email" aria-describedby="addon-wrapping" style="margin-left: 25%; margin-right: 25%;" id="emailidConform">
</div>
<span id="span2" ></span>
<br>
</div>
</div>
<div class="row" style="text-align: center;">
<div class="col lg-10 sm-4">
<!-- Radio buttons -->
<h6 style="margin-top: 2%; margin-bottom: 2%; color: #ef8451; ">
Choose your gender :
</h6>
<form style="margin-top: 3%; margin-bottom: 3%; margin-left: 40%; margin-right: 40;">
<input type="radio" name="radios" />Female
<input type="radio" name="radios" />Male
</form>
<span id="span3" style="color: red;"></span>
<br>
<br>
<br>
</div>
</div>
<div class="row" style="text-align: center;">
<div class="col lg-10 sm-4">
<!-- CheckBoxes -->
<h6 style="color: #ef8451; margin-bottom: 2% ;">
Choose a recipie :
</h6>
<div class="form-check form-check-inline" >
<input
class="form-check-input"
type="checkbox"
id="inlineCheckbox1"
value="1"
name="level"
/>
<label class="form-check-label" for="inlineCheckbox1"
>Lunch</label
>
</div>
<div class="form-check form-check-inline" >
<input
class="form-check-input"
type="checkbox"
id="inlineCheckbox2"
value="2"
name="level"
/>
<label class="form-check-label" for="inlineCheckbox2"
>Breakfast</label
>
</div>
<div class="form-check form-check-inline" >
<input
class="form-check-input"
type="checkbox"
id="inlineCheckbox3"
value="3"
name="level"
/>
<label class="form-check-label" for="inlineCheckbox3"
>Desserts</label
>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="checkbox"
id="inlineCheckbox3"
value="4"
name="level"
/>
<label class="form-check-label" for="inlineCheckbox3"
>Appetizers</label
>
<span id="span4" style="color: red;"></span>
<!-- <div id="second"></div> -->
</div>
<div id="first"></div>
</div>
<br>
<br>
</div>
<div class="row" style="text-align: center;">
<div class="col lg-10 sm-4">
<!-- text area -->
<h6 style="margin-bottom: 2%; margin-top: 2%; color: #ef8451">
Result:
</h6>
<div class="form-floating" style="margin-bottom: 3%">
<textarea
class="form-control"
placeholder="Leave a comment here"
id="floatingTextarea2"
style="height: 100px"
></textarea>
<label for="floatingTextarea2">Result</label>
</div>
<br />
<button
type="button"
class="btn btn-success"
onclick="validtion(); cal1();"
>
Submit
</button>
</div>
</div>
</form>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</body>
</html>