-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
62 lines (48 loc) · 2.09 KB
/
scripts.js
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
// scripts.js
document.addEventListener('DOMContentLoaded', () => {
// Booking Form Submission
const bookingForm = document.getElementById('bookingForm');
const bookingSuccess = document.getElementById('bookingSuccess');
bookingForm.addEventListener('submit', function(event) {
event.preventDefault();
// Collect form data
const bookingData = {
name: document.getElementById('name').value,
email: document.getElementById('email').value,
phone: document.getElementById('phone').value,
pickupDateTime: document.getElementById('pickupDateTime').value,
pickupLocation: document.getElementById('pickupLocation').value,
dropoffLocation: document.getElementById('dropoffLocation').value,
vehicleType: document.getElementById('vehicleType').value
};
// TODO: Send bookingData to the server or process it as needed
// Display success message
bookingSuccess.style.display = 'block';
// Reset form
bookingForm.reset();
});
// Sign-Up Form Submission
const signupForm = document.getElementById('signupForm');
const signupSuccess = document.getElementById('signupSuccess');
signupForm.addEventListener('submit', function(event) {
event.preventDefault();
// Collect form data
const password = document.getElementById('signupPassword').value;
const confirmPassword = document.getElementById('confirmPassword').value;
// Validate password and confirm password
if (password !== confirmPassword) {
alert('Passwords do not match. Please try again.');
return;
}
const signupData = {
name: document.getElementById('signupName').value,
email: document.getElementById('signupEmail').value,
password: password
};
// TODO: Send signupData to the server or process it as needed
// Display success message
signupSuccess.style.display = 'block';
// Reset form
signupForm.reset();
});
});