Remove form

This commit is contained in:
Skylar Grant 2024-09-12 12:32:59 -04:00
parent f6a5ec5a77
commit 65e327c83d
1 changed files with 14 additions and 19 deletions

View File

@ -44,20 +44,19 @@
</div> </div>
</form> </form>
<form id="printTempPw" class="space-y-4 mt-12"></form> <div>
<div> <label for="password" class="block text-sm font-medium text-gray-700">Temp Password:</label>
<label for="password" class="block text-sm font-medium text-gray-700">Temp Password:</label> <input type="text" id="password" name="password" required
<input type="text" id="password" name="password" required class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"> </div>
</div>
<div class="text-center"> <div class="text-center">
<button type="submit" <button type="submit"
class="w-full bg-gray-500 text-white py-2 px-4 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-opacity-50 mt-2"> id="printTempPw"
Print Temp Password class="w-full bg-gray-500 text-white py-2 px-4 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-opacity-50 mt-2">
</button> Print Temp Password
</div> </button>
</form> </div>
</div> </div>
@ -109,12 +108,8 @@
.catch(error => alert('Error: ' + error)); .catch(error => alert('Error: ' + error));
}); });
document.getElementById('printTempPw').addEventListener('submit', (event) => { document.getElementById('printTempPw').addEventListener('click', (event) => {
event.preventDefault(); // Prevent the form from submitting normally const password = document.getElementById('password').value;
// Get the form data
const formData = new FormData(event.target);
const password = formData.get('password');
// Send a POST request with the form data to the server // Send a POST request with the form data to the server
fetch('/print-temp-pw', { fetch('/print-temp-pw', {