-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery.html
More file actions
174 lines (143 loc) · 6.05 KB
/
Copy pathquery.html
File metadata and controls
174 lines (143 loc) · 6.05 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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Query Form</title>
<link rel="stylesheet" href="query.css">
<script>
//validation process
function getSelectedValue(selectList) {
return selectList[selectList.selectedIndex].value;
}
function validateform() {
function emailValidation(gmail) {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(gmail)
}
let name = document.forms["footballQuery"]["name"].value;
if (name == null || name == "") {
alert("Please enter your name");
return false;
}
let customerEmail = document.forms["footballQuery"]["email"].value;
if (customerEmail == "") {
alert("Please write a valid email");
return false;
}
if (emailValidation(customerEmail) == false){
alert("Please enter a valid Email");
return false;
}
let selectList = document.forms["footballQuery"]["subject"].value;
if (selectList == "select"){
alert("Please choose a subject");
return false;
}
let details = document.forms["footballQuery"]["details"].value;
if (details == null || details == "") {
alert("please provide some details");
return false;
}
}
</script>
</head>
<body>
<!--header-->
<section class="sub-header">
<nav>
<a href="index.html"><img src="images/FootballLogo.png" alt="logo"></a>
<div class="nav-links">
<ul>
<li><a href="index.html">HOME</a></li>
<li><a href="https://w1824897.users.ecs.westminster.ac.uk/Webdev/Sitemap.html">SITEMAP</a></li>
<li><a href="https://w1789487.users.ecs.westminster.ac.uk/webDev/Products.html">PRODUCTS</a></li>
<li><a href="https://w1821973.users.ecs.westminster.ac.uk/WebDev/about.html">ABOUT US</a></li>
<li><a href="https://w1821973.users.ecs.westminster.ac.uk/WebDev/Quiz.html">QUIZ</a></li>
<li><a href="query.html">CONTACT US</a></li>
<li><a href="content.html">CONTENT</a></li>
</ul>
</div>
</nav>
<h1>CONTACT US</h1>
</section>
<!--form-->
<div class="contact-us">
<!--start of contact class-->
<form action="mailto:w1633664@westminster.ac.uk" enctype="text/plain" method="post" name="footballQuery">
<div id="form">
<!-- start of div form-->
<label for="name"> Name</label>
<input type="text" name="Name" id="name" placeholder="Full name ">
<label for="email"> Email</label>
<input type="email" name="email" id="email" placeholder="example@email.com">
<label for="subject">Subject</label>
<select name="Subject" id="subject">
<option value="select">Select A Query Subject</option>
<option value="Order Updates">Order Updates</option>
<option value="Mising Products">Missing Products</option>
<option value="Review">Review</option>
<option value="Other">Other</option>
</select>
<label for="details">Details </label>
<textarea name="details" id="details" cols="43" rows="5"></textarea>
<button onclick=validateform() type="button" id="checkDetails" class="hero-btn" >Check Details</button>
</div> <!-- end of div form -->
<!--edit button-->
<div id="edit">
<!-- start of displayForm -->
<p><u>Name</u> <span id="nameDisplay"></span></p>
<p><u>Email</u> <span id="emailDisplay"></span></p>
<p><u>Subject</u> <span id="subjectDisplay"></span></p>
<p><u>Details</u> <span id="detailsDisplay"></span></p>
<button type="button" id="editDetails" class="hero-btn">Edit Details</button>
<button type="submit" class="hero-btn">Submit Details</button>
</div>
</form>
</div>
<!--start of javascript-->
<script>
// get the select list
function getSelectedValue(selectList) {
return selectList[selectList.selectedIndex].value;
}
//changing the input pages
document.getElementById("checkDetails").addEventListener("click", function () {
let customerName = document.getElementById("name").value;
document.getElementById("nameDisplay").innerHTML = customerName;
let customerEmail = document.getElementById("email").value;
document.getElementById("emailDisplay").innerHTML = customerEmail;
let querySubject = getSelectedValue(document.getElementById("subject"));
document.getElementById("subjectDisplay").innerHTML = querySubject;
let queryDetail = document.getElementById("details").value;
document.getElementById("detailsDisplay").innerHTML = queryDetail;
//email validation
function emailIsValid(gmail) {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(gmail)
}
// to check if the requirements have been met
if (customerName != "" && customerEmail != "" && queryDetail != "" && emailIsValid(customerEmail) != false && querySubject != "select") {
document.getElementById("form").style.display = "none";
document.getElementById("edit").style.display = "block";
}
});
document.getElementById("editDetails").addEventListener("click", function () {
document.getElementById("form").style.display = "block";
document.getElementById("edit").style.display = "none";
});
</script>
<!--back to top button-->
<div class="love2">
<a href="#top" class="hero-btn">back to top</a>
</div>
<!-- footer-->
<section class="footer">
<h4>About Us</h4>
<p>The proud owners of footaholics have been designing and producing the footaholics website with tender loving care.
<br>We are the best service provided around.</p>
<p>copyright© 2022 Footaholics</p>
<!-- page editor button-->
</section>
<div class="love2">
<a href="page-editor.html" class="hero-btn">Link to page editor</a>
</div>
</body>
</html>