Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
muskan171105 authored Oct 11, 2024
1 parent 32a2adf commit e63e717
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<title>Event Registration</title>
<link rel="icon" href="\static\favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="\static\style.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-qrcode/1.0/jquery.qrcode.min.js"></script>
</head>

<body>
Expand Down Expand Up @@ -55,6 +57,7 @@ <h2>Register Here</h2>
<button type="button" id="loadProgress" class="btnn">Load Progress</button>
</div>
</form>
<div id="qrCodeDiv"></div>
</div>
</div>

Expand All @@ -67,7 +70,7 @@ <h2>Register Here</h2>
errorElement.classList.add("error-text");
errorElement.innerText = errorText;
field.closest(".form").appendChild(errorElement);
};
}

const handleFormData = (e) => {
e.preventDefault();
Expand Down Expand Up @@ -113,8 +116,19 @@ <h2>Register Here</h2>
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");
Expand Down Expand Up @@ -151,7 +165,6 @@ <h2>Register Here</h2>

saveButton.addEventListener("click", saveProgress);
loadButton.addEventListener("click", loadProgress);
form.addEventListener("submit", handleFormData);
</script>
</body>

Expand Down

0 comments on commit e63e717

Please sign in to comment.