-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
178 lines (149 loc) · 6.91 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Quote Form</title>
</head>
<body>
<!-- Header with Logo and Company Name -->
<header>
<div id="header-container">
<img src="images/logo.png" alt="Company Logo" id="company-logo">
<label for="company-logo" id="logo-label">PA's Go-To for Solar Panel Cleaning & Maintenance!</label>
</div>
</header>
<!-- Quote Form -->
<section id="quote-form-section">
<form id="quote-form" action="https://formspree.io/f/mqazjvne" method="POST">
<h2>Get A Free Quote Today!</h2>
<!-- Required Fields -->
<div class="form-row">
<div class="form-group">
<label for="name">Full Name*</label>
<input type="text" id="name" name="name" required>
</div>
<div class="form-group">
<label for="address">Address*</label>
<input type="text" id="address" name="address" required>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="zip">Zip Code*</label>
<input type="text" id="zip" name="zip" required>
</div>
<div class="form-group">
<label for="phone">Phone Number*</label>
<input type="tel" id="phone" name="phone" required>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="email">Email*</label>
<input type="email" id="email" name="email" required>
</div>
<div id="toggle-optional-fields-container">
<label for="toggle-optional-fields">Have more information? Click here!</label>
<button type="button" id="toggle-optional-fields">Show</button>
</div>
</div>
<!-- Optional Fields -->
<div id="optional-fields" style="display: none;">
<div class="form-row">
<div class="form-group">
<label for="arrays">Number of Solar Arrays</label>
<input type="number" id="arrays" name="arrays">
</div>
<div class="form-group">
<label for="stories">Number of Stories</label>
<input type="number" id="stories" name="stories">
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="description" class="textarea-label">Additional Information</label>
<textarea id="description" name="description" rows="1" cols="50"></textarea>
</div>
<div class="form-group">
<label for="system">System Model</label>
<select id="system" name="system">
<option value="">Select System Model</option>
<option value="System1">System 1</option>
<option value="System2">System 2</option>
<option value="System3">System 3</option>
<option value="OTHER">Other (Specify)</option>
</select>
</div>
</div>
<div id="other-system" class="form-row" style="display: none;">
<label for="otherSystem">Specify Other System</label>
<input type="text" id="otherSystem" name="otherSystem">
</div>
</div>
<!-- Spam Protection -->
<input type="text" name="_gotcha" style="display:none">
<!-- Submit Button -->
<input type="submit" value="Submit">
</form>
</section>
<!-- Image and Text Description Section -->
<section class="image-section">
<div class="image-container">
<img src="images/image1.png" alt="Image 1">
<img src="images/image2.png" alt="Image 2">
</div>
<div class="image-container">
<img src="images/image3.png" alt="Image 3">
<img src="images/image4.png" alt="Image 4">
</div>
<div class="image-container">
<img src="images/image5.png" alt="Image 5">
<img src="images/image6.png" alt="Image 6">
</div>
</section>
<!-- JavaScript for Form Submission Handling and Optional Fields Toggle -->
<script>
document.getElementById('quote-form').addEventListener('submit', function(event) {
event.preventDefault(); // Prevent default form submission
fetch(this.action, {
method: this.method,
body: new FormData(this),
headers: { 'Accept': 'application/json' }
}).then(response => {
if (response.ok) {
alert('SUCCESS! Your quote request has been sent.');
this.reset();
document.getElementById('optional-fields').style.display = 'none'; // Hide optional fields after form reset
document.getElementById('other-system').style.display = 'none'; // Hide OTHER input after form reset
} else {
alert('FAILED... Please try again later.');
}
}).catch(error => {
alert('FAILED... Please try again later.');
});
});
// JavaScript to toggle "Specify Other System" input
document.getElementById('system').addEventListener('change', function() {
const otherSystem = document.getElementById('other-system');
if (this.value === 'OTHER') {
otherSystem.style.display = 'block';
} else {
otherSystem.style.display = 'none';
}
});
// JavaScript to toggle optional fields visibility
document.getElementById('toggle-optional-fields').addEventListener('click', function() {
const optionalFields = document.getElementById('optional-fields');
if (optionalFields.style.display === 'none') {
optionalFields.style.display = 'block';
this.textContent = 'Hide';
} else {
optionalFields.style.display = 'none';
this.textContent = 'Show';
}
});
</script>
</body>
</html>