diff --git a/templates/index.html b/templates/index.html index 6e6ba01..c21f0ec 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,6 +7,8 @@ Event Registration + + @@ -55,6 +57,7 @@

Register Here

+
@@ -67,7 +70,7 @@

Register Here

errorElement.classList.add("error-text"); errorElement.innerText = errorText; field.closest(".form").appendChild(errorElement); - }; + } const handleFormData = (e) => { e.preventDefault(); @@ -113,8 +116,19 @@

Register Here

const errorInputs = document.querySelectorAll(".form .error"); if (errorInputs.length > 0) return; + // QR Code data: Full name, Stream, and Event + const qrData = `Name: ${fullname}\nStream: ${stream}\nEvent: ${event}`; + + // Generate QR code + QRCode.toCanvas(document.getElementById("qrCodeDiv"), qrData, function (error) { + if (error) console.error(error); + console.log('QR Code generated!'); + }); + form.submit(); - }; + } + + form.addEventListener("submit", handleFormData); // Save Progress Functionality const saveButton = document.getElementById("saveProgress"); @@ -151,7 +165,6 @@

Register Here

saveButton.addEventListener("click", saveProgress); loadButton.addEventListener("click", loadProgress); - form.addEventListener("submit", handleFormData);