-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoyota.html
More file actions
194 lines (184 loc) · 8.32 KB
/
toyota.html
File metadata and controls
194 lines (184 loc) · 8.32 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Toyota</title>
<style>
/* Add your CSS styles here */
.form-container {
max-width: 500px;
margin: 0 auto;
padding: 20px;
border: 2px solid #ccc;
border-radius: 10px;
background-color: #f9f9f9;
font-family: Arial, sans-serif;
}
.form-field {
margin-bottom: 20px;
}
.form-field label {
display: block;
font-weight: bold;
margin-bottom: 5px;
}
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="submit"] {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
box-sizing: border-box;
}
.form-field input[type="checkbox"] {
margin-right: 5px;
}
.confirmation {
margin-top: 30px;
padding: 20px;
border: 2px solid #ccc;
border-radius: 10px;
background-color: #f9f9f9;
font-family: Arial, sans-serif;
}
.confirmation h2 {
margin-bottom: 10px;
}
</style>
</head>
<body>
<div class="form-container">
<form id="carForm">
<div class="form-field">
<label for="name">Name</label>
<input type="text" id="name" placeholder="Enter your name">
</div>
<div class="form-field">
<label for="email">Email</label>
<input type="email" id="email" placeholder="Enter your email">
</div>
<div class="form-field">
<label for="contact">Contact no.</label>
<input type="text" id="contact" placeholder="Enter your contact number">
</div>
<div class="form-field">
<label>Gender</label>
<label for="female">Female</label>
<input type="checkbox" id="female" name="gender" value="Female">
<label for="male">Male</label>
<input type="checkbox" id="male" name="gender" value="Male">
</div>
<div class="form-field">
<label for="pickupLocation">Pickup Location</label>
<input type="text" id="pickupLocation" placeholder="Enter pickup location">
</div>
<div class="form-field">
<label for="dropLocation">Drop Location</label>
<input type="text" id="dropLocation" placeholder="Enter drop location">
</div>
<div class="form-field">
<label for="pickupTime">Pickup Time</label>
<input type="text" id="pickupTime" placeholder="Enter pickup time">
</div>
<div class="form-field">
<label for="dropTime">Drop Time</label>
<input type="text" id="dropTime" placeholder="Enter drop time">
</div>
<div class="form-field">
<label for="pickupDate">Pickup Date</label>
<input type="text" id="pickupDate" placeholder="Enter pickup date">
</div>
<div class="form-field">
<label for="dropDate">Drop Date</label>
<input type="text" id="dropDate" placeholder="Enter drop date">
</div>
<div class="form-field">
<label>With/Without driver</label>
<label for="withDriver">With</label>
<input type="checkbox" id="withDriver" name="driver" value="With">
<label for="withoutDriver">Without</label>
<input type="checkbox" id="withoutDriver" name="driver" value="Without">
</div>
<div class="form-field">
<input type="submit" id="submitBtn" value="Submit">
<button type="button" id="updateBtn" onclick="updateBooking()">Update</button>
</div>
</form>
</div>
<div class="confirmation" id="confirmation">
<!-- Confirmation message will be displayed here -->
</div>
<script>
// Define a variable to store booking details
let bookingDetails = {};
// Function to update booking details
function updateBooking() {
// Populate form fields with existing booking details
document.getElementById("name").value = bookingDetails.name || "";
document.getElementById("email").value = bookingDetails.email || "";
document.getElementById("contact").value = bookingDetails.contact || "";
document.getElementById("pickupLocation").value = bookingDetails.pickupLocation || "";
document.getElementById("dropLocation").value = bookingDetails.dropLocation || "";
document.getElementById("pickupTime").value = bookingDetails.pickupTime || "";
document.getElementById("dropTime").value = bookingDetails.dropTime || "";
document.getElementById("pickupDate").value = bookingDetails.pickupDate || "";
document.getElementById("dropDate").value = bookingDetails.dropDate || "";
document.getElementById("withDriver").checked = bookingDetails.driver === "With";
document.getElementById("withoutDriver").checked = bookingDetails.driver === "Without";
// Display a message indicating that the form has been updated
document.getElementById("confirmation").innerHTML = "<p>Form updated. Make changes and click 'Submit' to save.</p>";
}
// Function to submit the form
document.getElementById("carForm").addEventListener("submit", function(event) {
event.preventDefault(); // Prevent the default form submission
// Collect input values
const name = document.getElementById("name").value;
const email = document.getElementById("email").value;
const contact = document.getElementById("contact").value;
const gender = document.querySelector('input[name="gender"]:checked').value;
const pickupLocation = document.getElementById("pickupLocation").value;
const dropLocation = document.getElementById("dropLocation").value;
const pickupTime = document.getElementById("pickupTime").value;
const dropTime = document.getElementById("dropTime").value;
const pickupDate = document.getElementById("pickupDate").value;
const dropDate = document.getElementById("dropDate").value;
const driver = document.querySelector('input[name="driver"]:checked').value;
// Store booking details
bookingDetails = {
name: name,
email: email,
contact: contact,
gender: gender,
pickupLocation: pickupLocation,
dropLocation: dropLocation,
pickupTime: pickupTime,
dropTime: dropTime,
pickupDate: pickupDate,
dropDate: dropDate,
driver: driver
};
// Display confirmation message
const confirmationSlip = `
<div class="confirmation">
<h2>Confirmation Slip</h2>
<p><strong>Name:</strong> ${name}</p>
<p><strong>Email:</strong> ${email}</p>
<p><strong>Contact:</strong> ${contact}</p>
<p><strong>Gender:</strong> ${gender}</p>
<p><strong>Pickup Location:</strong> ${pickupLocation}</p>
<p><strong>Drop Location:</strong> ${dropLocation}</p>
<p><strong>Pickup Time:</strong> ${pickupTime}</p>
<p><strong>Drop Time:</strong> ${dropTime}</p>
<p><strong>Pickup Date:</strong> ${pickupDate}</p>
<p><strong>Drop Date:</strong> ${dropDate}</p>
<p><strong>Driver:</strong> ${driver}</p>
<p>Booking confirmed. Thank you!</p>
</div>
`;
document.getElementById("confirmation").innerHTML = confirmationSlip;
});
</script>
</body>
</html>