lokesh341 commited on
Commit
d108c10
·
verified ·
1 Parent(s): 8af8df5

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +13 -2
templates/index.html CHANGED
@@ -109,9 +109,14 @@
109
  isCapturingName = false;
110
  isCapturingEmail = true;
111
  status.textContent = "Your name is captured. Now listening for your email...";
 
 
 
 
112
  speak("Now, please tell me your email, letter by letter", function() {
113
  startListeningForEmail(); // Start email capture
114
  });
 
115
  return; // Exit function to prevent "next" from being added to the name
116
  }
117
 
@@ -124,8 +129,9 @@
124
  function startListeningForEmail() {
125
  const status = document.getElementById('status');
126
  const emailInput = document.getElementById('email');
127
-
128
- // Reinitialize recognition
 
129
  recognition = new webkitSpeechRecognition();
130
  recognition.continuous = false;
131
  recognition.interimResults = false;
@@ -140,9 +146,14 @@
140
  recognition.stop(); // Stop recognition for email
141
  isCapturingEmail = false;
142
  status.textContent = 'Registration complete.';
 
 
 
 
143
  speak("Registration complete. Thank you!", function() {
144
  setTimeout(() => location.reload(), 10000); // Refresh after 10 sec
145
  });
 
146
  return; // Exit function to prevent "next" from being added
147
  }
148
 
 
109
  isCapturingName = false;
110
  isCapturingEmail = true;
111
  status.textContent = "Your name is captured. Now listening for your email...";
112
+
113
+ // Ensure name input is finalized
114
+ nameInput.value = currentName.trim();
115
+
116
  speak("Now, please tell me your email, letter by letter", function() {
117
  startListeningForEmail(); // Start email capture
118
  });
119
+
120
  return; // Exit function to prevent "next" from being added to the name
121
  }
122
 
 
129
  function startListeningForEmail() {
130
  const status = document.getElementById('status');
131
  const emailInput = document.getElementById('email');
132
+
133
+ // Reset recognition for email input
134
+ recognition.stop();
135
  recognition = new webkitSpeechRecognition();
136
  recognition.continuous = false;
137
  recognition.interimResults = false;
 
146
  recognition.stop(); // Stop recognition for email
147
  isCapturingEmail = false;
148
  status.textContent = 'Registration complete.';
149
+
150
+ // Ensure email input is finalized
151
+ emailInput.value = currentEmail.trim();
152
+
153
  speak("Registration complete. Thank you!", function() {
154
  setTimeout(() => location.reload(), 10000); // Refresh after 10 sec
155
  });
156
+
157
  return; // Exit function to prevent "next" from being added
158
  }
159