Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +61 -43
templates/index.html
CHANGED
@@ -170,51 +170,69 @@
|
|
170 |
}
|
171 |
|
172 |
function showRegistrationForm() {
|
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 |
</script>
|
219 |
</body>
|
220 |
</html>
|
|
|
170 |
}
|
171 |
|
172 |
function showRegistrationForm() {
|
173 |
+
document.getElementById('registrationForm').style.display = 'block';
|
174 |
+
speak("Please say your name to begin registration.", startListeningForName);
|
175 |
+
}
|
176 |
+
|
177 |
+
// Function to start listening for the name
|
178 |
+
function startListeningForName() {
|
179 |
+
recognition.start();
|
180 |
+
recognition.onresult = function(event) {
|
181 |
+
const name = event.results[0][0].transcript.trim();
|
182 |
+
nameField.value = name;
|
183 |
+
recognition.stop();
|
184 |
+
listeningText.textContent = "Listening for your email...";
|
185 |
+
step++;
|
186 |
+
setTimeout(startListeningForEmail, 500); // Wait a moment before listening for email
|
187 |
+
};
|
188 |
+
}
|
189 |
+
|
190 |
+
// Function to start listening for the email
|
191 |
+
function startListeningForEmail() {
|
192 |
+
recognition.start();
|
193 |
+
recognition.onresult = function(event) {
|
194 |
+
const email = event.results[0][0].transcript.trim();
|
195 |
+
emailField.value = email;
|
196 |
+
recognition.stop();
|
197 |
+
listeningText.textContent = "Listening for your mobile number...";
|
198 |
+
step++;
|
199 |
+
setTimeout(startListeningForMobile, 500); // Wait a moment before listening for mobile
|
200 |
+
};
|
201 |
+
}
|
202 |
+
|
203 |
+
// Function to start listening for the mobile number
|
204 |
+
function startListeningForMobile() {
|
205 |
+
recognition.start();
|
206 |
+
recognition.onresult = function(event) {
|
207 |
+
const mobile = event.results[0][0].transcript.trim();
|
208 |
+
mobileField.value = mobile;
|
209 |
+
recognition.stop();
|
210 |
+
listeningText.textContent = "Almost done...";
|
211 |
+
submitBtn.disabled = false; // Enable the submit button
|
212 |
+
};
|
213 |
+
}
|
214 |
+
|
215 |
+
// Function to submit the form
|
216 |
+
submitBtn.addEventListener('click', function() {
|
217 |
+
const name = nameField.value;
|
218 |
+
const email = emailField.value;
|
219 |
+
const mobile = mobileField.value;
|
220 |
+
|
221 |
+
if (name && email && mobile) {
|
222 |
+
alert(`Registration successful for ${name}`);
|
223 |
+
// Here, you can send the registration data to the backend or Salesforce
|
224 |
}
|
225 |
+
});
|
226 |
|
227 |
+
// Function to speak a message (for better user interaction)
|
228 |
+
function speak(message, callback) {
|
229 |
+
const msg = new SpeechSynthesisUtterance(message);
|
230 |
+
window.speechSynthesis.speak(msg);
|
231 |
+
msg.onend = callback;
|
232 |
+
}
|
233 |
+
|
234 |
+
// Start the process by showing the registration form
|
235 |
+
showRegistrationForm();
|
236 |
</script>
|
237 |
</body>
|
238 |
</html>
|